简体   繁体   English

为什么这段代码有错误

[英]why this code has error

//this is a part of html code
<form>
    <b>user:</b> <input type="text" name="user" size="25"/>
    <input type="button" name ="submit" value="confirm" onclick= "mehdi(this.form)"/>
</form>
<script type="text/javascript">
    function mehdi(rno){
        rno.user.value =  2 * Math.PI ;//this is error line user is unknown 

        alert(rno);
        return rno;
    }
</script>

what can i do? 我能做什么?

Try This 尝试这个

<form>
    <b>user:</b> <input type="text" name="user" size="25"/>
 <input type="button" name ="submit" value="confirm" onclick= "mehdi(this.form)">
</form>

 <script type="text/javascript">
          function mehdi(rno)
          {
           rno.user.value =  2 * Math.PI ;//this is error line user is unknown 

           alert(rno.user.value);
           return rno.user.value;
           }

 </script>

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 我的JavaScript代码有错误 - My JavaScript code has an error 为什么 React 中的代码可以运行,但几周后就出错了? 类型错误:无法读取未定义的属性(读取“切片”) - Why the code in react was working, but few weeks later it has error? TypeError: Cannot read properties of undefined (reading 'slice') 为什么此代码未引发错误? - Why is the error not thrown in this code? 为什么此代码显示错误? - Why this code is showing error? 破码? 为什么它停止工作 - Broken code? Why has it stopped working 为什么在此代码中计数已减少? - Why in this code count has been decremented? 为什么 onreadystatechange 在这段代码中没有类似语法的方法? - Why onreadystatechange has not a method like syntax in this code? 为什么 VS 代码的变量名有问题? - why VS code has problem with variable name? Webrtc和socket.io:createanswer()总是有错误。 为什么?。 我的代码将两个对等点连接起来,但是其中只有一个知道吗? - Webrtc and socket.io: createanswer() always has an error. Why?. My code connects two peers, but only one of them knows about it? 为什么我下面的异步 function 得到错误代码 'Uncaught SyntaxError: Identifier 'message' has already been declared”? - Why does my asynchronous function below get the error code 'Uncaught SyntaxError: Identifier 'message' has already been declared"?
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM