编程论坛's Archiver

game15888 发表于 2008-4-7 16:50

这个是那里错了~?

<html >
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312" />
<title>无标题文档</title>
<script language="javascript">
function calculate(form)
{
form.result.value = eval(form.ente.value);

}
function getExpression(form)
{
form.ente.blur();
form.ente.value = prompt("Please enter a JavaScript mathematical expression","");
calculate(form);
}
</script>

</head>

<body>
<form  method="post" >
Enter a JavaScript mathematical expression:
<input type=text name="ente" value=""  onfocus ="getExpression(this.form);" />
<br>
The result of this expression is:
<input type=text name="result" value="" onfocus ="this.blur();" />
</form>
</body>
</html>

game15888 发表于 2008-4-7 19:22

请大家下到自己电脑里试试这个程序,看看那里不对

lmhllr 发表于 2008-4-7 20:46

请楼主发帖说明这个代码是做什么用的,别让人猜好吗?

你这样问是没人会花时间去帮你的

我运行了,但我不知道你的代码是做什么用的,不知道你的问题是什么,不想又看

[[it] 本帖最后由 lmhllr 于 2008-4-7 20:48 编辑 [/it]]

game15888 发表于 2008-4-7 21:10

实现功能:
在name="ente"的文本框里输入数字,然后弹出一个输入对话框,输入的数字显示在name="result"的文本框里。

页: [1]

Powered by Discuz! Archiver 6.1.0  © 2001-2007 Comsenz Inc.