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

為了賬號安全,請及時綁定郵箱和手機立即綁定
已解決430363個問題,去搜搜看,總會有你想問的

.value 和 .nodeValue 的區別

.value 和 .nodeValue 的區別

胡說叔叔 2023-03-18 11:05:35
我添加了在此表單上啟用自動完成功能所需的 JavaScript 代碼。<form>    <label for='shippingName'>Name</label>    <input type='text' id='shippingName' name='shippingName' required></br></br>          </form><form>    <input type='checkbox' id='same' name='same' onchange='billingFunction()'>    <label for='same'>Is the Billing Information the Same?</label>      <label for='billingName'>Name</label>    <input type='text' id='billingName' name='billingName'></br></br>        <input type='submit' value='Verify'></form>我的腳本:function billingFunction(){    if(document.getElementById('same').checked) {        var name = document.getElementById('shippingName').value;             document.getElementById('billingName').value = name;            }else{        document.getElementById('billingName').value = "";            }}我的問題是,如果我在 var 名稱中使用 .nodeValue 而不是 .value,該函數將不起作用。它們之間有什么區別?
查看完整描述

1 回答

?
Helenr

TA貢獻1780條經驗 獲得超4個贊

.nodeValue不應該用于獲取輸入的值,它旨在獲取文本節點的數據和數據部分等內容。



查看完整回答
反對 回復 2023-03-18
  • 1 回答
  • 0 關注
  • 88 瀏覽
慕課專欄
更多

添加回答

舉報

0/150
提交
取消
微信客服

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

幫助反饋 APP下載

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

公眾號

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