2012-04-02 51 views
-2

我建立了这个简单的脚本来输入一定数量的个数,更改输入字符

现在我想用这个,但用字,我将如何改变Num ==输入什么,我应该将其更改?

非常感谢

<script type="text/javascript"> 
function check_number() 
{ 
    var num = document.getElementById('input_number').value; 
    if (num == smaller){ 
     document.getElementById('result_image_correct').style.display = 'block'; 
     document.getElementById('result_image_incorrect').style.display = 'none'; 
     document.getElementById('result_image_correct2').style.display = 'block'; 
    } 
    else{ 
     document.getElementById('result_image_incorrect').style.display = 'block'; 
     document.getElementById('result_image_correct').style.display = 'none'; 
     } 

} 
</script> 
+0

在你的例子中'small'是什么?它在哪里定义? – 2012-04-02 13:08:59

+0

你在做什么?这适用于什么HTML标记? “较小”来自哪里,它与字符数据有什么关系? – 2012-04-02 13:09:03

+0

一个数字通常会在这里,但我希望它检查字符“小”而不是数字 – Ma9ic 2012-04-02 13:12:12

回答

1

然后,只需改变smaller"smaller"'smaller'