By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
438,394 Members | 1,912 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 438,394 IT Pros & Developers. It's quick & easy.

Safari giving problem with {display:none}

hsriat
Expert 100+
P: 1,654
All the elements which were set as style={display:none} are still being shown in Safari (Apple's Browser)...

But when the same style is applied with javascript on an event, it hides the element.
Like this...
Expand|Select|Wrap|Line Numbers
  1. document.getElementById('abc').style.display='none';
This one is also not working:
[HTML]style="{background-image:url('/img/logo.png');background-repeat:no-repeat}" [/HTML]

Both are working all good with Firefox, Opera and even IE 6 (which I actually didn't expect).

What could be the reason?
Feb 12 '08 #1
Share this Question
Share on Google+
2 Replies


Death Slaught
100+
P: 1,137
If you're using them as inline styles simply remove the curly braces.

Expand|Select|Wrap|Line Numbers
  1.  style="display:none;"
As for the image do the same and add a space between the colon and 'url'.

Expand|Select|Wrap|Line Numbers
  1.  style="background-image: url('location');"
Thanks,
{\_/}
(' . ')
(")[DEATH](")
(")(")
Feb 12 '08 #2

hsriat
Expert 100+
P: 1,654
If you're using them as inline styles simply remove the curly braces.

Expand|Select|Wrap|Line Numbers
  1.  style="display:none;"
As for the image do the same and add a space between the colon and 'url'.

Expand|Select|Wrap|Line Numbers
  1.  style="background-image: url('location');"
Thanks,
{\_/}
(' . ')
(")[DEATH](")
(")(")
oo.... thats working now!!
Thanks a lot!!! :)

Can you please tell me one more thing...
[HTML]<a class="button" id="ax1" href="javascript:void(0)" onclick='edit('x1')">&nbsp;Edit&nbsp;</a>[/HTML]

and function edit(id) is
Expand|Select|Wrap|Line Numbers
  1. function edit(id) {
  2.     var anc = document.getElementById('a'+id);
  3.      anc.innerHTML = anc.innerHTML=="&nbsp;Save&nbsp;" ? "&nbsp;Edit&nbsp;" : "&nbsp;Save&nbsp;";
  4. }
This is working fine with Firefox and IE, ie, the name of the A element gets changed from ' Save ' to ' Edit ' and ' Edit ' to ' Save ' on every click. But Opera and Safari are not doing any change.
If I remove the &nbsp; from both, then its working fine with all.
But since its a button kind of look, so I need to give space on both sides of the name.

How can I solve this?
Feb 13 '08 #3

Post your reply

Sign in to post your reply or Sign up for a free account.