实现更复杂的交互 (5)
[ 来源:互网络 | 更新日期:2007-09-04 10:50:33 | 浏览次数:12174]
简介:html"> <Frameset Cols="50%,50%"><frame src="test9_2
</Script>
</BODY>
</HTML>
从上面程序可以看出:
可通过write()和prompt()方法实现交互。
在JavaScript脚本语言中可以使用HTML标识语言的代码。从而实现混合编程。其中<H1>和<Br>就是HTML标识符。
四、范例
下列程序演示了你进入主页所停留的时间。
test7_2.htm
<html>
<form name="myform">
<td vAlign="top" width="135">您在此停留了:
<input name="clock" size="8" value="在线时间"></td>
</form>
<script language="JavaScript">
var id, iM = 0, iS = 1;
start = new Date();
function go()
{
now = new Date();
time = (now.getTime() - start.getTime()) / 1000;
time = Math.floor( time);
iS = time % 60;
iM = Math.floor( time / 60);
if ( iS < 10)
document.myform.clock.value = " " + iM + " 分 0" + iS + " 秒";
else
document.myform.clock.value = " " + iM + " 分 " + iS + " 秒";
id = setTimeout( "go()", 1000);
}
go();
</script>
</body>
</html>
在浏览器中的结果,见图1所示。
<Option>河南省 </select><

您的位置:
