关于一些JavaScript代码的问题.

来源:百度知道 编辑:UC知道 时间:2024/05/28 05:22:56
代码是这样:

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html>
<head>
<title>
第一个函数
</title>
<script language=“JavaScript” type=“text/javascript” >
function hello()
{
var s=document.h.cishu.value,i=0;
for(i=0;i<s;i++){
document.write("<h2>hello<h2>");
}
}
</script>
<style type="text/css">
</style>
</head>
<body>
<form name="h" action="">
请输入您想要hello的次数:
<input name="cishu" id="cishu" type="text"/><br/>
<input name="kaishi" id="kaishi" type="

function hello(){
s = document.getElementById("cishu").value;
for (i = 0; i < s; i++){
document.write("<h2>hello</h2>");
}
}

刚刚测试了下。。发觉你

<script language=“JavaScript” type=“text/javascript” >
这一段引号的问题。。你用的是全角的引号。。换成英文的引号就是了。

<html>
<head>
<title>
第一个函数
</title>
<script>
function hello()
{
alert("aaa");
var s=document.h.cishu.value;
var i=0;
for(i=0;i<s;i++){
document.write("<h2>hello<h2>");
}
}
</script>
</head>
<body>
<form name="h" action="">
请输入您想要hello的次数:
<input name="cishu" type="text"><br/>
<input name="kaishi" type="button" value="开始了" onclick="hello(