亚洲在线久爱草,狠狠天天香蕉网,天天搞日日干久草,伊人亚洲日本欧美

為了賬號安全,請及時綁定郵箱和手機立即綁定

返回節點為0 input的節點點擊無彈出

<!DOCTYPE HTML>

<html> ?

<head> ?

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

<title>JavaScript</title> ?

</head> ?

<body> ?

? ??

? ? ? ? <form name="Input">

? ? ? ? ? ? <table align="center" width="500px" height="50%" border="1">

? ? ? ? ? ? ? ? <tr>

? ? ? ? ? ? ? ? ? ? <td align="center" width="100px">

? ? ? ? ? ? ? ? ? ? ? ? 學號:

? ? ? ? ? ? ? ? ? ? </td>

? ? ? ? ? ? ? ? ? ? <td align="center" width="300px">

? ? ? ? ? ? ? ? ? ? ? ? <input type="text" id=userid name="user" onblur="validate();">

? ? ? ? ? ? ? ? ? ? ? ? <div id=usermsg></div>

? ? ? ? ? ? ? ? ? ? </td>

? ? ? ? ? ? ? ? </tr>

? ? ? ? ? ? ? ? <tr>

? ? ? ? ? ? ? ? ? ? <td align="center" width="100px">

? ? ? ? ? ? ? ? ? ? ? ? 姓名:

? ? ? ? ? ? ? ? ? ? </td>

? ? ? ? ? ? ? ? ? ? ? ? <td align="center">

? ? ? ? ? ? ? ? ? ? ? ? <input type="text" name="name">

? ? ? ? ? ? ? ? ? ? </td>

? ? ? ? ? ? ? ? </tr>

? ? ? ? ? ? ? ? <tr>

? ? ? ? ? ? ? ? ? ? <td align="center" width="%45">

? ? ? ? ? ? ? ? ? ? ? ? 性別:

? ? ? ? ? ? ? ? ? ? </td>

? ? ? ? ? ? ? ? ? ? <td align="center">

? ? ? ? ? ? ? ? ? ? ? ? <input type="radio" name="sex" value="男">

? ? ? ? ? ? ? ? ? ? ? ? 男

? ? ? ? ? ? ? ? ? ? ? ? <input type="radio" name="sex" value="女">

? ? ? ? ? ? ? ? ? ? ? ? 女

? ? ? ? ? ? ? ? ? ? </td>

? ? ? ? ? ? ? ? </tr>

? ? ? ? ? ? ? ? <tr>

? ? ? ? ? ? ? ? ? ? <td align="center" width="30%">

? ? ? ? ? ? ? ? ? ? ? ? 年齡:

? ? ? ? ? ? ? ? ? ? </td>

? ? ? ? ? ? ? ? ? ? <td align="center" width="300px">

? ? ? ? ? ? ? ? ? ? ? ? <input type="text" name="age">

? ? ? ? ? ? ? ? ? ? </td>

? ? ? ? ? ? ? ? </tr>

? ? ? ? ? ? ? ? <tr>

? ? ? ? ? ? ? ? ? ? <td align="center" width="100px">

? ? ? ? ? ? ? ? ? ? ? ? 地址:

? ? ? ? ? ? ? ? ? ? </td>

? ? ? ? ? ? ? ? ? ? <td align="center" width="300px">

? ? ? ? ? ? ? ? ? ? ? ? <input type="text" name="addr">

? ? ? ? ? ? ? ? ? ? </td>

? ? ? ? ? ? ? ? </tr>


? ? ? ? ? ? </table>

? ? ? ? </form>

? ? ? ? <h1 id="myHead" onclick="getValue()">

? ? ? ? ? ? 看看三種獲取節點的方法?

? ? ? ? </h1>

? ? ? ? <p>

? ? ? ? ? ? 點擊標題彈出它的值。

? ? ? ? </p>

? ? ? ? <input type="button" onclick="getElements()"

? ? ? ? ? ? value="看看name為sex的節點有幾個?" />

? ? ? ? <Br>

? ? ? ? <input type="button" onclick="getTagElements()"

? ? ? ? ? ? value="看看標簽名為input的節點有幾個?" />

? ? ? ? ? ??

? ? ?<script type="text/javascript">

? ? ? ? ?function getValue()

? ? ? ? ? {

? ? ? ? ?var myH=document.getElementById ("myHead" ) ; ? ?

? ? ? ? ? ? ? alert(myH.innerHTML)

? ? ? ? ? }

? ? ? ? ? function getElements()

? ? ? ? ? {

? ? ? ? ? var myS=document.getElementsByName("radio") ;

? ? ? ? ? ? ? alert(myS.length);

? ? ? ? ? }


? ? ? ? ? function getTagElements()

? ? ? ? ? {

? ? ? ? ? var myI=document.getElementByTagname("input") ?;

? ? ? ? ? ? ? alert(myI.length);

? ? ? ? ? }

? ? ? ? ?

? ? ?</script> ? ? ? ?


? ? </body>

</html>


正在回答

1 回答

一個細節錯誤:

應該是 document.getElementsByTagName("input")

而不是 document.getElementByTagname("input")

少寫了“s”,“n”為大寫。

1 回復 有任何疑惑可以回復我~
#1

慕容1574223 提問者

恩 我 試試
2018-05-10 回復 有任何疑惑可以回復我~

舉報

0/150
提交
取消

返回節點為0 input的節點點擊無彈出

我要回答 關注問題
微信客服

購課補貼
聯系客服咨詢優惠詳情

幫助反饋 APP下載

慕課網APP
您的移動學習伙伴

公眾號

掃描二維碼
關注慕課網微信公眾號