点击在当前页打开网站
<a href="http://www.love99.com/">这是我的网站</a>
效果:这是我的网站
点击弹出网站
<a href="http://www.love99.com/" target="_blank">这是我的网站</a>
<br>这个是向下一行,比如
欢迎光临我的网站<br>希望开心
演示效果就是:
欢迎光临我的网站
希望开心
<p>向下一大行,比如
欢迎光临我的网站<p>希望开心
演示效果就是:
欢迎光临我的网站
希望开心
<b>这是粗体字
比如 <b >我的网站</ b>
演示效果:我的网站
我的网站这是字体的颜色BLUE是蓝,RED是红
演示
忽视右键
<body >或
<body style="overflow-y:hidden">
如何几秒后转到别的页面?
<META. HTTP-EQUIV="Refresh" C>
点击关闭窗口
<a href="javascript.:top.window.close();">点击关闭窗口</a>!
请问如何去掉主页右面的滚动条?
<body scroll="no">
<body style="overflow-y:hidden">
如何做到让一个网页自动关闭.
<html>
<head>
<OBJECT id=closes type="application/x-oleobject" classid="clsid:adb880a6-d8ff-11cf-9377-00aa003b7a11">
<param name="Command" value="Close">
</object>
</head>
<body >
这个窗口会在10秒过后自动关闭,而且不会出现提示. </body>
如何在不刷新页面的情况下刷新css?
<style>
button{ color:#000000;}
</style>
<button nclick=document.styleSheets[0].rules[0].style.color=‘‘‘‘red‘‘‘‘>点击按钮直接修改style标签里button选择符使按钮改为红色</button>
请问如何让网页自动刷新?
在head部记入<META. HTTP-EQUIV="Refresh" c>其中20为20秒后自动刷新,你可以更改为任意值。
如何让页面自动刷新?
方法一,用refresh
HTML 代码片段如下:
<head>
<meta. http-equiv="refresh" c>
</head>
5表示刷新时间
[Ctrl+A 全部选择 提示:你可先修改部分代码,再按运行]
方法二,使用setTimeout控制
<img src=/logo.gif>
<script>
function rl(){
document.location.reload()
}
setTimeout(rl,2000)
</script>
如何让超链接没有下划线
在源代码中的<HEAD>…</HEAD>之间输入如下代码:
<style. type="text/css"> <!--
a { text-decoration: none}
--> </style>
请问如何去掉IE的上下滚动条?
<body style=‘‘‘‘overflow:scroll;overflow-y:hidden‘‘‘‘>
</body>
怎样才能把RealPlayer文件在网页做一个试听连接?
<embed height=25src=51js.rm type=audio/x-pn-realaudio-plugin width=50 autostart="false" c>
如何用html实现浏览器上后退按钮的功能?
<a href="java script.:history.go(-1)">点击后退</a>
或者 <script> history.back() </script>
请问怎么在网页中改变鼠标的箭头形状?
HTML 代码片段如下:
<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>
怎样不使用页面的缓存?即每一次打开页面时不是调用缓存中的东西
<META. HTTP-EQUIV="ragma" C>
页面打开时自动弹出一个窗口的代码怎么写?
HTML 代码片段如下:
<html>
<head>
<title>Untitled Document</title>
<meta. http-equiv="Content-Type" c>
<script. language="<B style="color:black;background-color:#A0FFFF">javascript</B>">
<!--
function MM_openBrWindow(theURL,winName,features) { //v2.0
window.open(theURL,winName,features);
}
//-->
</script>
<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>
怎样不使用页面的缓存?即每一次打开页面时不是调用缓存中的东西
<META. HTTP-EQUIV="ragma" C>
页面打开时自动弹出一个窗口的代码怎么写?
HTML 代码片段如下:
<html>
<head>
<title>Untitled Document</title>
<meta. http-equiv="Content-Type" c>
<script. language="<B style="color:black;background-color:#A0FFFF">javascript</B>">
<!--
function MM_openBrWindow(theURL,winName,features) { //v2.0
window.open(theURL,winName,features);
}
//-->
</script>
1。忽视右键
<body ncontextmenu="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="#"
nclick="javascript:window.open(文件路径/文件名,newwindow,
toolbar=no,scrollbars=yes,resizable=no,top=0,left=0,
width=400,height=300);">文字或图片</a>
参数解释:
<SCRIPT. LANGUAGE="javascript"> js脚本开始;
window.open 弹出新窗口的命令;
文件路径/文件名 弹出窗口的文件名;
newwindow 弹出窗口的名字(不是文件名),非必须,可用空代替;
width=400 窗口宽度;
height=300 窗口高度;
top=0 窗口距离屏幕上方的象素值;
left=0 窗口距离屏幕左侧的象素值;
toolbar=no 是否显示工具栏,yes为显示;
menubar,scrollbars表示菜单栏和滚动栏。
resizable=no 是否允许改变窗口大小,yes为允许;
location=no 是否显示地址栏,yes为允许;
status=no 是否显示状态栏内的信息(通常是文件已经打开),yes为允许;
</SCRIPT> js脚本结束
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 nload="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 nload="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="background-color: green"></IFRAME>
16. ncontextmenu="window.event.returnValue=false"将彻底屏蔽鼠标右键
<table border ncontextmenu=return(false)><td>no</table>可用于Table
17. <body nselectstart="return false"> 取消选取、防止复制
18.οnpaste="return false" 不准粘贴
19.οncοpy="return false;" ncut="return false;"防止复制
20. <link rel="Shortcut Icon" href="favicon.ico"> IE地址栏前换成自己的图标
21. <link rel="Bookmark" href="favicon.ico">可以在收藏夹中显示出你的图标
22. <input style="ime-mode:disabled"> 关闭输入法
23. 永远都会带着框架
<script. language="JavaScript"><!--
if (window == top)top.location.href = "frames.htm"; //frames.htm为框架网页
// --></script>
24. 防止被人frame.
<SCRIPT. LANGUAGE=JAVASCRIPT><!--
if (top.location != self.location)top.location=self.location;
// --></SCRIPT>
25. 网页将不能被另存为
<noscript><iframe. src=*.html></iframe></noscript>
26. 查看网页源代码
<input type=button value=查看网页源代码
οnclick="window.location = "view-source:"+ "http://www.pconline.com.cn"">
27.删除时确认
<a href="javascript:if(confirm("确实要删除吗?"))location="boos.asp? &areyou=删除&page=1"">删除</a>
28.屏蔽功能键Shift,Alt,Ctrl
<script>
function look(){
if(event.shiftKey)
alert("禁止按Shift键!"); //可以换成ALTCTRL
}
document.οnkeydοwn=look;
</script>
29. 网页不会被缓存
<META. HTTP-EQUIV="pragma" CONTENT="no-cache">
<META. HTTP-EQUIV="Cache-Control" CONTENT="no-cache, must-revalidate">
<META. HTTP-EQUIV="expires" CONTENT="Wed, 26 Feb 1997 08:21:57 GMT">
或者<META. HTTP-EQUIV="expires" CONTENT="0">
30.怎样让表单没有凹凸感?
<input type=text style="border:1 solid #000000">
或 <input type=text style="border-left:none; border-right:none; border -top:none; border-bottom: 1 solid #000000"></textarea>
31.不要滚动条?
让竖条没有:
<body style="overflow:scroll;overflow-y:hidden">
</body>
让横条没有:
<body style="overflow:scroll;overflow-x:hidden">
</body>
两个都去掉?更简单了
<body scroll="no">
</body>
32.怎样去掉图片链接点击后,图片周围的虚线?
<a href="#" nFocus="this.blur()"><img src="logo.jpg" border=0></a>
33.电子邮件处理提交表单
<form. name="form1" method="post" action="mailt****@***.com" enctype="text/plain">
<input type=submit>
</form>
34.在打开的子窗口刷新父窗口的代码里如何写?
window.opener.location.reload()
35.如何设定打开页面的大小
<body nload="top.resizeTo(300,200);">
打开页面的位置<body nload="top.moveBy(300,200);">
36.在页面中如何加入不是满铺的背景图片,拉动页面时背景图不动
<STYLE>
body
{background-image:url(logo.gif); background-repeat:no-repeat;
background-position:center;background-attachment: fixed}
</STYLE>
37. 检查一段字符串是否全由数字组成
<script. language="Javascript"><!--
function checkNum(str){return str.match(//D/)==null}
alert(checkNum("1232142141"))
alert(checkNum("123214214a1"))
// --></script>
38. 获得一个窗口的大小
document.body.clientWidth; document.body.clientHeight
39. 怎么判断是否是字符
if (/[^/x00-/xff]/g.test(s)) alert("含有汉字");
else alert("全是字符");
40.TEXTAREA自适应文字行数的多少
<textarea rows=1 name=s1 cols=27 npropertychange="this.style.posHeight=this.scrollHeight">
</textarea>
41. 日期减去天数等于第二个日期
<script. language=Javascript>
function cc(dd,dadd)
{
//可以加上错误处理
var a = new Date(dd)
a = a.valueOf()
a = a - dadd * 24 * 60 * 60 * 1000
a = new Date(a)
alert(a.getFullYear() + "年" + (a.getMonth() + 1) + "月" + a.getDate() + "日")
} cc("12/23/2002",2)
</script>