Javascript在safari中显示/隐藏功能 [英] Javascript show/hide function in safari
本文介绍了Javascript在safari中显示/隐藏功能的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
你好!!
我有一个javascript函数来显示/隐藏[ runat =server] div
它适用于所有浏览器但是Safari
javascript函数:
Hello!!
I have a javascript function to show/hide a [runat="server"] div
it works in all browsers but Safari
javascript function:
<script type="text/javascript">
function Show_Hide_Display() {
var div1 = document.getElementById('<%=main_filter.ClientID%>');
if (div1.style.display == "" || div1.style.display == "block") {
div1.style.display = "none";
}
else {
div1.style.display = "block";
}
return false;
}
</script>
调用javascript函数:
calling the javascript function:
<pre><div class="col-md-6 col-xs-3 pull-right btn-mobile">
<input type="button" class="btn btn-primary btn-block span3" id="closefilter" value="Done" onclick="Show_Hide_Display()" />
</div>
请告知
我尝试了什么:
我试图使用JQuery但是仍然相同:
please advise
What I have tried:
I tried to use JQuery but still the same:
$(document).ready(function () {
$("#closefilter").click(function () {
$("main_filter").hide();
});
});
从JavaScript函数中删除了(IF)语句但仍然相同。
使用
removed the (IF) statement from the JavaScript function but still the same.
used
document.getElementByClassName
但是也一样!!
推荐答案
( document )。ready( function (){
(document).ready(function () {
( #closefilter)。click( function (){
("#closefilter").click(function () {
( main_filter)。hide();
}) ;
});
("main_filter").hide(); }); });
从JavaScript函数中删除了(IF)语句但仍然相同。
使用
removed the (IF) statement from the JavaScript function but still the same.
used
document.getElementByClassName
但也一样!!
这篇关于Javascript在safari中显示/隐藏功能的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文