document.write("hello world");
<a href="javascript:alert('helloword')">我在这里</a>
<a href="#" οnclick="alert('helloword')">我在这里</a>
button的跳转
history.back() 后退
history.forward() 前进
history.go(-2) 后退两步
<form>
按钮禁用
<html>
<head>
<script language="javascript">
function checkValid(form)
{
document.getElementById("submitbutton").disabled=true;
return false;
}
</script>
</head>
<body>
<form action="" method="post" >
<input type="submit" value="提交" id="submitbutton" οnclick="return checkValid(this)"/>
</form>
</body>
</html>
设置窗口大小
<script type="text/javascript">
function resizewin(w,h)
{
window.resizeTo(w,h)
}
</script>
<body οnlοad=resizewin(550,600)>
设置投票
<html>
<head>
<title>js投票</title>
<meta http-equiv="Content-Type" content="text ml; charset=gb2312">
</head>
<body>
<SCRIPT LANGUAGE="JavaScript">
var t=0;
var f=0;
function setstar()
{
t++;
document.all.tt.innerHTML=t;
}
function resetvalue(){
f++;
document.all.ff.innerHTML=f;
}
//-->
</SCRIPT>
<div style="font-size:48pt;">
</div>
<from id="fr1">
<table id="tb2">
<tr>
<td><a href="#" onClick="setstar()">支持</a><span id="tt"></td><td><a href="#" onClick="resetvalue()">反对</a><span id="ff"></td>
</tr>
</table>
</form>
</body>
<html>