时间:2023-09-30 03:06:02 | 来源:网站运营
时间:2023-09-30 03:06:02 来源:网站运营
HTML实用的网页代码大全:【一】:符号<p>段落</p>
【二】:字体移动字体(走马灯):<marquee>文字</marquee>
【三】:body标记的属性
【四】:特殊样式在新窗口打开连接:<a href="要跳转的目标路径" target="_blank">要输入的文字</a> (target=_blank表示用新窗口打开页面,一般出现在<a>标签中,target表示链接在哪里打开,可以为它赋已经存在的窗口名或者一些默认的值,常见的一些默认的值有:_blank 新窗口 _self 自身 _parent 父窗口 _top 顶层窗口(框架中))
body{ background-image: url("123.gif"); background-repeat: no-repeat; background-position: center;}
<!DOCTYPE html><html lang="en"><head> <meta charset="UTF-8"> <title>方式一</title> <script language="JavaScript"> function colseit() { setTimeout("self.close()",10000) } </script></head><body onload="colseit()"><p>我爱学习</p><p>学习爱我</p><p>沉迷学习</p><p>无法自拔</p></body></html><--------------------------------------------------------><!DOCTYPE html><html lang="en"><head> <meta charset="UTF-8"> <title>方式二</title> <style type="text/css"></style></head><body onload="setTimeout(window.close,3000)"><p>我爱学习</p><p>学习爱我</p><p>沉迷学习</p><p>无法自拔</p></body></html><--------------------------------------------------------><!DOCTYPE html><html lang="en"><head> <meta charset="UTF-8"> <title>方式三</title></head><body bgcolor="f0d070" vlink="3300fc"><table border="0" width="288"> <tr> <td class="cc1">自动关闭窗口示例</td> </tr></table><script language="JavaScript"> function clock() { i=i-1; document.title="本窗口将在"+i+"秒后自动关闭"; if(i>0) setTimeout("clock()",1000); else self.close(); } var i=10; clock();</script></body></html>
网页自动刷新:<!DOCTYPE html><html lang="en"><head> <meta charset="UTF-8"> <title>网页自动刷新</title> <meta http-equiv="refresh" content="5"> <!--5为5秒后自动刷新--></head><body><p>我爱学习</p><p>学习爱我</p><p>沉迷学习</p><p>无法自拔</p></body></html>
网页自动跳转:<!DOCTYPE html><html lang="en"><head> <meta charset="UTF-8"> <title>网页自动跳转</title> <meta http-equiv="refresh" content="5;URL=demo1.html"> <!--5秒后自动跳转--></head><body><p>哈哈</p></body></html>
返回上一页:<!DOCTYPE html><html lang="en"><head> <meta charset="UTF-8"> <title>返回上一页</title></head><body><a href="javascript:history.back(1)">【返回上一页】</a></body></html>
关闭窗口:<!DOCTYPE html><html lang="en"><head> <meta charset="UTF-8"> <title>方式一</title> <script type="text/javascript"> function show() { alert("点击【确定】将自动关闭窗口"); window.opener=null; window.open("","_self"); window.close(); } </script></head><body onload="show()"><p>我爱学习</p><p>学习爱我</p><p>沉迷学习</p><p>无法自拔</p></body></html><-----------------------------------------------------><!DOCTYPE html><html lang="en"><head> <meta charset="UTF-8"> <title>方式二</title></head><body><a href="javascript:self.close()">【关闭窗口】</a></body></html>
取消选取:<body onselectstart="return false"><script language="JavaScript"> if(window==top){top.location.href="框架地址";} </script>
简单的页面加密:<script language="JavaScript"> function loopy() { var sWord=""; while(sWord!="login"){ sWord=prompt("请输入你的登录密码"); alert("登陆成功!"); } loopy(); } </script>
禁止使用Shift,Ctrl,Alt功能键:<script> function look() { if(event.shiftKey){alert("禁止使用Shift键")} if(event.altKey){alert("禁止使用Alt键")} if(event.ctrlKey){alert("禁止使用Ctrl键")} } document.onkeydown=look; </script>
取消竖条滚动条:<body style="overflow: scroll;overflow-y: hidden"><form name="form1" method="post" action="mailt****@***.com" enctype="text/plain"> <input type="submit"></form>
检查一段字符串是否全由数字组成:<script language="JavaScript"> function checkNum(str) { return str.match()==null; } alert(checkNum("121312312312")); alert(checkNum("190900m2312")) </script>
改变光标形状:<span style="cursor: move">Auto</span>关键词:实用