2010-05-06 57 views
-1

我有兩個div我需要執行切換兩個div 這樣做時,我的主div的一些div即使我使用hide()函數,這隻會發生在ie7切換不起作用在IE 7

function initMakeAPost() 

{ 

    $('questionheaderid').hide(); //hiding the questions section 
    $('MP_questionofday_txtboxid').hide();//hiding the questions answer"textbox and button" section 
    $('recaspotheaderid').hide();//hiding the search by txtspotname and city-spots 
    //$('footer_userpost').hide();//hiding the footer 
    $('makeapostid').show();//show the make a post content 
    $('btnQAPost').hide(); 
    $('footer_userpost').hide(); 
    $('sreetCredContainer').hide(); 
    $('postbtnid_dead').hide(); 
    $('askNextQuestion').hide(); 
    //$('UploadImgContainer').show();// for upload 

} 
+4

善神人。使用標點符號。 – 2010-05-06 19:37:12

+0

添加JQuery作爲標記,因爲Javascript不太準確。 – 2010-05-06 19:52:21

+0

他們看起來更像我的Prototype ID選擇器。 – bobince 2010-05-06 20:51:19

回答

1

首先,你的jQuery選擇似乎是無效的:

即:

$('questionheaderid') // matches the tag "questionheaderid" 
$('#questionheaderid') // matches any tag with the id="questionheaderid" 
$('.questionheaderid') // matches any tag with class="questionheaderid" 

接下來,.hide()/播放()方法只需添加/刪除顯示:無風格fr om匹配的項目。如果您在具有比inline更高優先級的單獨樣式表中添加了其他CSS,則它們可以覆蓋您使用jquery設置的任何內容。如果您在CSS文件中設置初始狀態並嘗試使用內聯樣式進行覆蓋,有時會發生這種情況。

+0

感謝您的回覆我使用的原型... tats我使用$('id')所以我需要檢查內聯樣式fr這個div這是你的建議??非常感謝你的回覆 – praveen 2010-05-06 21:06:19

0

顯示和隱藏真的很簡單,應該「只是工作」。如果沒有,我想看到相應的標記(也可能是css)。也許有些東西讓IE的行爲不同(像往常一樣)。 :)

順便說一句,這裏是由ID對大量元素做隱藏/顯示一個提示:

$('id0', 'id1', 'id2', 'id3').invoke('hide'); 
$('id4', 'id5').invoke('show'); 

它在prototype.js中的文檔中描述:http://api.prototypejs.org/dom/dollar/