HTML代码大全(初学者必备)

1.图片:跳转地址+图片地址+图片尺寸+边框

<a href="链接的地址"><img src="图片的URL" width="图片的宽度" height="图片的高度" border="边框"></a>

2.链接:跳转地址+打开形式+文字颜色+显示文字

target=”_blank”(将在新窗口打开链接)

target=”_parent”(将在父窗口或框架中打开网页)

target=”_self”(将在本页面打开链接)

target=”_top”(将忽略框架,在顶端打开窗口)

<a href="跳转链接地址" target="打开形式标签"><font color="#颜色代码">显示文字</font></a>

3.点击关闭窗口

<a href="javascript:top.window.close();">点击关闭窗口</a>

4.屏蔽右键(两种)

<body oncontextmenu="return false">
<body style="overflow-y:hidden">

5.几秒后转到别的页面

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

6.去掉主页右边的滚动条

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

7.网页自动关闭

<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>

8.网页自动刷新

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

9.超链接去除下划线

<style type="text/css"> <!--

  a { text-decoration: none}

  --> </style>

10.点击后退事件的两种代码

<a href="java script:history.go(-1)">点击后退</a>
<script> history.back() </script>

11.改变鼠标箭头代码

<body>

  <a href="#" style="cursor: auto;">auto</a><br>

  <a href="#" style="cursor: crosshair ">crosshair </a><br>

  <a href="#" style="cursor: default ">default </a><br>

  <a href="#" style="cursor: hand ">hand </a><br>

  <a href="#" style="cursor: move ">move </a><br>

  <a href="#" style="cursor: e-resize ">e-resize </a><br>

  <a href="#" style="cursor: ne-resize ">ne-resize </a><br>

  <a href="#" style="cursor: nw-resize">nw-resize</a><br>

  <a href="#" style="cursor: n-resize">n-resize</a><br>

  <a href="#" style="cursor: se-resize">se-resize</a><br>

  <a href="#" style="cursor: sw-resize">sw-resize</a><br>

  <a href="#" style="cursor: s-resize">s-resize</a><br>

  <a href="#" style="cursor: w-resize">w-resize</a><br>

  <a href="#" style="cursor: text">text</a><br>

  <a href="#" style="cursor: wait">wait</a><br>

  <a href="#" style="cursor: help">help</a><br>

  </body>

12.网页禁止被其它框架嵌套

<script>

  if (window.top!=self){

  window.top.location=self.location

  }

  </script>

13.网页body文字不可被选中代码

<body onselectstart="return false" >填写文字</body>
© 版权声明
THE END
点赞500 分享
评论 抢沙发

请登录后发表评论