2010-05-06 51 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/