إخفاء DIV لا يعمل بشكل صحيح في Opera
-
06-07-2019 - |
سؤال
يعمل الكود الخاص بي بشكل رائع في IE8 وFirefox وSafari.لكنه لا يعمل بشكل صحيح في الأوبرا.ما يحدث هو أن DIV مخفي ولكن المساحة التي يشغلها DIV تظل تظهر في صفحة الويب الخاصة بي.
<div style=" z-index:-1;height :380; width:760; position:relative; text-align:center" id="new-add">
<object id="banner-flash" classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000"
codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,40,0"
width="769" height="382" top="0">
<param name="movie" value="exp.swf" />
<param name="quality" value="high" />
<param name="bgcolor" value="#ffffff" />
<param name="wmode" value="transparent" />
<embed src="exp.swf" wmode="transparent" quality="high" bgcolor="#ffffff" width="780" height="382"
name="mymoviename" align="" type="application/x-shockwave-flash"
pluginspage="http://www.macromedia.com/go/getflashplayer">
</embed>
</object>
</div>
<div id="fechar-link" style=" font-family: Verdana,Arial,Helvetica,sans-serif; font-style: normal;
font-variant: normal; font-weight: normal; font-size: 10pt; line-height: normal; font-size-adjust: none;
font-stretch: normal; text-decoration: none; text-align:center" >
<a href="#" onclick="
document.getElementById('new-add').style.height =0;
document.getElementById('banner-flash').style.height =0;
document.getElementById('fechar-link').style.height = 0;
document.getElementById('new-add').style.visibility ='hidden';
document.getElementById('banner-flash').style.visibility ='hidden';
document.getElementById('fechar-link').style.visibility ='hidden'; " >Close</a>
</div>
ما الذي يجب علي فعله حتى تختفي المساحة التي يشغلها DIV؟
شكرًا
المحلول
يمكنك تجربة الخاصية style.display :
يخفي
document.getElementById('YourElem').style.display = 'none';
يعرض
document.getElementById('YourElem').style.display = '';
يحرر: أخذ تعليق PorneL في الحساب في هذه الإجابة
نصائح أخرى
وأنا لا أعرف ما إذا كان سيتم حل مشكلتك، ولكن يمكنك محاولة استخدام:
document.getElementById("xxx").display = "none";
وبدلا من
document.getElementById("xxx").style.visibility = "hidden";
لا تنتمي إلى StackOverflow