猿问

在dreamweaver里表单 调用check函数来表现表单里的分数的等级,浏览器浏览时没有效果

<%@LANGUAGE="JAVASCRIPT" CODEPAGE="936"%>

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

<html xmlns="http://www.w3.org/1999/xhtml">

<head>

<meta http-equiv="Content-Type" content="text/html; charset=gb2312" />

<title>无标题文档</title>

<head>

<script  type="text/javascript" >

function check()

{

var score=formal.textfield.value;

if(score>=90 && score<100)

{document.write("A");}

else if(score>=75 && score<90)

{document.write("B");

else if(score>=60 && score<75)

{document.write("C");}

else{document.write("D");}

}

</script>

</head>

<body>


<form id="formal" name="formal" method="post" action="">

<p>

请输入你的分数:

  <label>

  <input type="text" name="textfield" />

  </label>

</p>

<input type ="button" name="button" value="按钮" onclick="check()"/>

</p>

</form>

</body>

</html>


慕粉3244922
浏览 1294回答 1
1回答

李晓健

function check(){     var score=formal.textfield.value;     if(score>=90 && score<100)     {document.write("A");}     else if(score>=75 && score<90)     {document.write("B");}//这里少一个 }     else if(score>=60 && score<75)     {document.write("C");}     else{document.write("D");}     }看注释
随时随地看视频慕课网APP

相关分类

JavaScript
我要回答