站长论坛

标题: 网页常用代码小结 [打印本页]

作者: ajax    时间: 2007-10-6 14:05
标题: 网页常用代码小结
点击返回上页代码:

<form>
<p><input TYPE="button" VALUE="返回上一步" ONCLICK="history.back(-1)"></p>
</form>

弹出警告框代码:

<form>
<p><input TYPE="button" VALUE="弹出警告框" ONCLICK="AlertButton()"></p>
</form>
<script language="JavaScript"><!--
function AlertButton(){window.alert("要多多光临呀!");}
// --></script>

点击打开新窗口

<form>
<p><input TYPE="button" VALUE="打开新窗口" ONCLICK="NewWindow()"></p>
</form>
<script language="JavaScript"><!--
function NewWindow(){window.open("http://www.chinahtml.com","","height=240,width=340,status=no,location=no,
toolbar=no,directories=no,menubar=no");}
// --></script></body>

删除记录时弹出确认框:

<script LANGUAGE="VBSCRIPT">
a=msgbox("真的要删除该记录吗?",1,"注意")
if a=1 then
location="Dodelete.asp?id=" //指向执行删除的页面Dodelete.asp
else
history.go(-1)
end if
</script>

关闭打开的窗口

< a href="/" onclick="javascript:window.close(); return false;">关闭窗口</a>




欢迎光临 站长论坛 (http://tzlink.com/bbs/) Powered by Discuz! X3.2