iT邦幫忙

0

有關input讀取變數問題

希望用input標籤在網頁上讀取javascript的變數
但是一直找不到問題在哪
希望各位大大幫忙解答
謝謝
以下為我的程式碼

<html xmlns="http://www.w3.org/1999/xhtml">

<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>無標題文件</title>




<form name="a"><p align="center"><input type="text" name="b" value="0" />Z
</form>

<script>
var b=100;
document.a.b.value;

 
</script>
 
圖片
  直播研討會
圖片
{{ item.channelVendor }} {{ item.webinarstarted }} |
{{ formatDate(item.duration) }}
直播中

1 個回答

4
wiseguy
iT邦超人 1 級 ‧ 2015-02-28 00:22:38
最佳解答

你是要把 b=100 這個值放進 <input name="b"> 嗎?請把第 15 行改為:

&lt;pre class="c" name="code">document.forms['a'].b.value = b;
mo460321 iT邦新手 5 級 ‧ 2015-02-28 00:32:24 檢舉

謝謝大大喔 我找到盲點了><
時間到就會選為最佳解答

我要發表回答

立即登入回答