• 技术文章 >web前端 >html教程

    html网页特效代码有哪些

    coldplay.xixicoldplay.xixi2021-03-16 15:19:22原创2107

    html网页特效代码有:1、字体加粗【<b>xx</b>】;2、字体斜体【<i>xx</i>】;3、字体控制大小【<h1>xx</h1>】;4、换帖子背景【<body background="xx">】;5、贴图【<img src=“”】。

    本教程操作环境:windows7系统、html5版,DELL G3电脑。

    html网页特效代码有:

    1)贴图:

    <img src="图片地址">

    2)加入连接:

    <a href="所要连接的相关地址">写上你想写的字</a>

    3)在新窗口打开连接:

    <a href="相关地址" target="_blank">写上要写的字</a>

    消除连接的下划线在新窗口打开连接:

    <a href="相关地址" style="text-decoration:none" target="_blank">写上你想写的字</a>

    4)移动字体(走马灯):

    <marquee>写上你想写的字</marquee>

    5)字体加粗:

    <b>写上你想写的字</b>

    6)字体斜体:

    <i>写上你想写的字</i>

    7)字体下划线:

    <u>写上你想写的字</u>

    8)字体删除线:

    <s>写上你想写的字</s>

    9)字体加大:

    <big>写上你想写的字</big>

    10)字体控制大小:

    <h1>写上你想写的字</h1>

    (其中字体大小可从h1-h5,h1最大,h5最小)

    11)更改字体颜色:

    <font color="#value">写上你想写的字</font>

    (其中value值在000000与ffffff(16位进制)之间

    12)消除连接的下划线:

    <a href="相关地址" style="text-decoration:none">写上你想写的字</a>

    13)贴音乐:

    <embed src=音乐地址 width=300 height=45 type=audio/mpeg autostart="false">

    14)贴flash:

    <embed src="flash地址" width="宽度" height="高度">

    15)贴影视文件:

    <img dynsrc="文件地址" width="宽度" height="高度" start=mouseover>

    16)换行:<br>

    17)段落:

    <p>段落</p>

    18)原始文字样式:

    <pre>正文</pre>

    19)换帖子背景:

    <body background="背景图片地址">

    20)固定帖子背景不随滚动条滚动:

    <body background="背景图片地址" body bgproperties=fixed>

    21)定制帖子背景颜色:<body bgcolor="#value">(value值见10)

    22)帖子背景音乐:<bgsound="背景音乐地址" loop=infinite>

    23)贴网页:<iframe src="相关地址" width="宽度" height="高度"></iframe>

    HTML特效代码1。忽视右键

      <body oncontextmenu="return false">

      或

     <body style="overflow-y:hidden">

    2.加入背景音乐

      IE:<bgsound src="*.mid" loop=infinite> 
      NS:<embed src="*.mid" autostart=true hidden=true loop=true> 
      </embed> 
      *.mid你的背景音乐的midi格式文件

    3. 简单的window.open方法

      <a href="#" 
      onclick="javascript :window.open(文件路径/文件名,newwindow, 
      toolbar=no,scrollbars=yes,resizable=no,top=0,left=0, 
      width=400,height=300);">文字或图片</a>

      参数解释:

    4. 简单的页面加密

      <script LANGUAGE="javascript"> 
      <!-- 
      function loopy(){ 
       var sWord =""; 
       while(sWord!="login"){sWord=prompt("请输入你的登陆密码");} 
       alert("登陆成功!"); 
      } 
      loopy() 
      //--> 
      </script>

    5. 拉动页面时背景图不动

      <style> 
      body{background-image:url(logo.gif); 
      background-repeat:no-repeat;background-position:center} 
      </style>

    6. 让浏览器在保存页面时保存失败

      <NOSCRIPT><iframe src="*.html"></iframe></NOSCRIPT>

    7. 随机替换图片

      <script> 
      document.write(<img src="img/+parseInt(Math.random()*(5)) 
      +.gif"height="40" width="50"> 
      </script>

      图片文件名为0.gif 1.gif 2.gif 3.gif 4.gif

    8. 窗口定时关闭

      先将如下代码网页文件的区:

      <script language="javascript"> 
      function closeit() { setTimeout("self.close()",10000) //毫秒 } 
      </script>

      然后再在<body>标内加入如:<body onload="closeit()">

    9. 网页自动关闭

      <html> 
      <head> 
      <object id=closes type="application/x-oleobject" 
      classid="clsid:adb880a6-d8ff-11cf-9377-00aa003b7a11"> 
      <param name="Command" value="Close"> 
      </object> 
      </head> 
      <body onload="window.setTimeout(closes.Click(),10000)"> 
      这个窗口会在10秒过后自动关闭,而且不会出现提示. 
      </body> 
      </html>

    10. 网页自动刷新

      在head部记入

      <META HTTP-EQUIV="Refresh" content="20">

      其中20为20秒后自动刷新,你可以更改为任意值。

    11. 网页自动转页

      <META HTTP-EQUIV="Refresh" CONTENT="时间(秒);URL=地址">

    12. 保持layer在最前面,而不被Iframe、Object所覆盖

      在Layer中再插Iframe 或 Object 设z-Index值

      <div z-Index:2><object xxx></object> # 前面 
      <div z-Index:1><object xxx></object> # 后面 
      <div id="Layer2" style="position:absolute; top:40;width:400px; 
      height:95px;z-index:2"> height=100% width=100%> 
      <iframe width=0 height=0></iframe> 
      </div> 
      <div id="Layer1" style="position:absolute; top:50;width:200px; 
      height:115px;z-index:1"> 
      <iframe height=100% width=100%></iframe> 
      </div>

    13.返回上一页

     <a href=javascript :history.back(1)>『返回上一页』</a>

    14.关闭窗口

      <a href=javascript :self.close()>『关闭窗口』</a>

    15.关于iframe的透明背景

      <IFRAME ID="iFrame1" SRC="iframe.htm" 
      allowTransparency="true" 
      style="</IFRAME>

    16. oncontextmenu="window.event.returnValue=false" 将彻底屏蔽鼠标右键

        <table border oncontextmenu=return(false)><td>no</table>

    可用于Table

    17.

    <body onselectstart="return false">

    取消选取、防止复制

    18.

    onpaste="return false"

    不准粘贴

    19.

    oncopy="return false;" oncut="return false;"

    防止复制

    相关学习推荐:html教程

    以上就是html网页特效代码有哪些的详细内容,更多请关注php中文网其它相关文章!

    声明:本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系admin@php.cn核实处理。
    专题推荐:html 网页特效
    上一篇:html滚动条样式如何设置 下一篇:html隐藏标签是什么
    PHP编程就业班

    相关文章推荐

    • 61个网页特效 很时尚 视觉效果很好_html/css_WEB-ITnose• 这种网页特效是用什么实现的?• 显示背景色网页特效CSS代码• jQuery实现日历每日签到网页特效

    全部评论我要评论

  • 取消发布评论发送
  • 1/1

    PHP中文网