MozTW 討論區
https://forum.moztw.org/

document.getElementById
https://forum.moztw.org/viewtopic.php?f=13&t=11797
1 頁 (共 1 頁)

發表人:  angus203 [ 2005-12-04, 14:54 ]
文章主題 :  document.getElementById

<span style="cursor: pointer;" onclick="document.getElementById('body').rows += 3;">▼</span>

IE 使用是沒有問題的.
這一句怎樣改成支援firefox~~

發表人:  dken [ 2005-12-04, 15:32 ]
文章主題 : 

你這裡的 'body',指的是 tag 而不是 id 這個屬性值吧?

也許可以試試用 getElementsByTagName。

發表人:  angus203 [ 2005-12-04, 20:16 ]
文章主題 : 

dken 寫:
你這裡的 'body',指的是 tag 而不是 id 這個屬性值吧?

也許可以試試用 getElementsByTagName。


body 是 textarea name

發表人:  why [ 2005-12-04, 21:15 ]
文章主題 : 

angus203 寫:
body 是 textarea name


<textarea name="">
<textarea id="">

你怎麼寫?

發表人:  angus203 [ 2005-12-06, 09:53 ]
文章主題 : 

why 寫:
angus203 寫:
body 是 textarea name


<textarea name="">
<textarea id="">

你怎麼寫?


<td><span style="cursor: pointer;" onclick="document.getElementById('body').rows += 3;">▼</span></td>
<textarea class="text" rows="4" cols="55" name="body" style="width:350"></textarea>

發表人:  angus203 [ 2005-12-06, 09:54 ]
文章主題 : 

dken 寫:
也許可以試試用 getElementsByTagName。


試了~~不行

發表人:  evenrain [ 2005-12-06, 10:21 ]
文章主題 : 

angus203 寫:
<td><span style="cursor: pointer;" onclick="document.getElementById('body').rows += 3;">▼</span></td>
<textarea class="text" rows="4" cols="55" name="body" style="width:350"></textarea>


你沒有設 ID ,用 getElementById 當然抓不到...
代碼:
<textarea class="text" rows="4" cols="55" name="body" id="body" style="width:350"></textarea>

如果不想設 ID,可以改用
代碼:
getElementsByName("body").item(0);

發表人:  angus203 [ 2005-12-08, 15:05 ]
文章主題 : 

謝謝~

1 頁 (共 1 頁) 所有顯示的時間為 UTC + 8 小時
Powered by phpBB® Forum Software © phpBB Group
https://www.phpbb.com/