with語句的問題
為什么我的with(document.forms[0]){ console.log(name.value); }會(huì)報(bào)以下錯(cuò): Uncaught TypeError: Cannot convert undefined or null to object
為什么我的with(document.forms[0]){ console.log(name.value); }會(huì)報(bào)以下錯(cuò): Uncaught TypeError: Cannot convert undefined or null to object
2018-04-15
舉報(bào)
2018-04-16
或者你可以在瀏覽器中輸入一個(gè) ?有表單元素的 ?網(wǎng)站,在chrome控制臺(tái)中,也可以獲取到。
如:www.baidu.com
2018-04-16
當(dāng)你在控制臺(tái),直接打印的時(shí)候,是會(huì)報(bào)錯(cuò)。你需要新建一個(gè)html文件,在里面新建form表單元素,以保證document文檔里面有form元素