467,907 Members | 1,352 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 467,907 developers. It's quick & easy.

Safari giving problem with {display:none}

hsriat
Expert 1GB
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
  • viewed: 16017
Share:
2 Replies
Death Slaught
1GB
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 1GB
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.

Similar topics

10 posts views Thread by JayB | last post: by
1 post views Thread by fleemo17 | last post: by
2 posts views Thread by 4MLA1FN | last post: by
2 posts views Thread by Good Man | last post: by
7 posts views Thread by khinester | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.