prompt对话框
<html>
<head>
<title>
函数
</title>
<Script language="JavaScript">
var userName = prompt("请输入你的名字:");
document.write("你好!"+userName);
</Script>
</head>
<body>
</body>
</html>
confirm对话框
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312" />
<title>无标题文档</title>
<script type="text/javascript">
//while(true)
///alert("ghahah");
function confirmit()
{
var obj=document.getElementById("testa");
if(confirm("你确认删除此文件么?"))
{
obj.submit();
}
}
</Script>
</head>
<body>
<form id="testa" action="ttt.jsp" method="post">
<input type="button" value="删除文件" οnclick="confirmit()" name="aaa">
</form>
</body>
</html>
<html>
<head>
<title>
函数
</title>
<Script language="JavaScript">
function confirmit()
{
if(confirm("你确认删除此文件么?"))
{
document.testa.submit();
}
}
</Script>
</head>
<body>
<form name="testa" action="ttt.jsp" method="post">
<input type="button" value="删除文件" οnclick="confirmit()" name="aaa">
</form>
</body>
</html>
this
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312" />
<title>无标题文档</title>
<!--prompt提示comfirm认证submit提交status状态-->
<Script type="text/javascript">
function checkit(obj)
{
if(obj.value=="")
{
alert("空值");
}
else
{
alert(obj.value);
}
}
</Script>
</head>
<body>
<img src="1.jpg" οnclick="alert(this.src);">
<form >
<input type="text" value="ddaaa" οnclick="checkit(this)">
</form>
</body>
</html>
///
下面的很少用
window.status
鼠标经过的时候
<html>
<head>
<title>
本地窗口
</title>
</head>
<body οnlοad="window.status='Hello,Please look here!'"><!--状态栏body的状态属性-->
<form name="ttt">
<input type="button" value="test" onMouseOver="window.status='haha';">
</form>
</body>
</html>
new windiow
前面是位置,后面是大小
<html>
<head>
<title>
新开窗口
</title>
</head>
<body>
<Script language="JavaScript">
window.open("1.htm","newWin","toolbar=no,left=200,top=100,menubar=no,width=100,height=100,resizable=no");
//window.open("1.htm","newWin","toolbar=no,left=200,top=100,menubar=no,width=100,height=100,resizable=no");
//window.open("1.htm");
</Script>
</body>
</html>
focus()close()
<html>
<head>
<title>
新开窗口
</title>
</head>
<body>
<Script language="JavaScript">
var abc = window.open("1.htm","newWin","toolbar=no,left=200,top=100,menubar=no,width=300,height=100");
</Script>
<input type="button" οnclick="JavaScript:abc.focus();" value="跑前面来">
<input type="button" οnclick="JavaScript:abc.close();" value="关闭">
</body>
</html>
window.location
网页的位置
<html>
<head>
<title>
本地窗口
</title>
</head>
<body>
<Script language="JavaScript">
//alert(window.location);
alert(document.location.href);
</Script>
</body>
</html>
<html>
<head>
<title>
本地窗口
</title>
</head>
<body>
<Script language="JavaScript">
function go2()
{
window.location="33.htm";
}
</Script>
<input type="button" value="转向" οnclick="JavaScript:go2()">
</body>
</html>
history.back();
<html>
<head>
<title>
本地窗口
</title>
</head>
<body>
<Script language="JavaScript">
function goBack()
{
history.back();
}
</Script>
<input type="button" value="返回" οnclick="JavaScript:goBack()">
</body>
</html>