您好我想创建一个网页,可以不间断地向数据库发送随机值.
例如
<html>
<HEAD>
<TITLE>HTML Title</TITLE>
</HEAD>
<BODY>
<H3 ALIGN="CENTER">
Ramdom number from 0 to 10 :
<FONT COLOR="RED">
<%= (int) (Math.random() * 10) %>
</FONT>
</H3>
<H4 ALIGN="CENTER">Refresh the page to see if the number changes...</H4>
</BODY>
</HTML>
Run Code Online (Sandbox Code Playgroud)
在哪个方向我应该使用applet或易于采用的东西.谢谢
您可以使用JavaScript来执行此操作.这非常简单.
window.onload = function ()
{
var output = document.getElementById('foo');
setInterval(function ()
{
output.innerHTML = Math.floor(Math.random() * 10);
}, 1000);
};
Run Code Online (Sandbox Code Playgroud)
演示:http://jsfiddle.net/mattball/c9t3T/
根据您示例中的HTML,您可能需要一些时间并开始学习CSS.
| 归档时间: |
|
| 查看次数: |
2414 次 |
| 最近记录: |