簡體   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>

我能做什么?

嘗試這個

<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.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM