2010-11-29 34 views
0

這是我的代碼來解決保持兼容的getElementById在IE中,FF,歌劇等getElementsByName歌劇,即等

function getId(item) { 
     if(window.mmIsOpera) return(document.getElementById(item)); 
     if (document.all) return(document.all[item]); 
     if (document.getElementById) return(document.getElementById(item)); 
    return(false); 
    } 

我的問題是,如何在getElementsByName即FF,歌劇..

+2

請你幫個忙,並使用像[jQuery的]庫(HTTP ://jquery.com)。 – jwueller 2010-11-29 13:48:27

+2

你在那裏修理什麼?所有這些瀏覽器支持getElementById多年以來(自V5.0以來的IE,自5.12以來的Opera) – 2010-11-29 13:51:05

回答

0

我昨晚得到了解決......
和T Ø得到的文本字段的值,只是在形式上增加一個atribut「名」 .. 像戴維·多沃德說:document.nameOfForm.nameOfTextfield.value