/    Sign up×
Community /Pin to ProfileBookmark

tags for all browsers?

Hi!

I’ve made a homepage with lots of java script code to hide/show layers with text and images. I use document.all[layer].style.visibility=”hidden”; but this only works with Internet Explorer. Can I write it in another way to run with other browsers like Netscape, Firefox and Opera? Or do I have use separately code for each browsers?

Is document.getElementById an alternative? How does it work?

Thanks for answers!

Nyfiken?

to post a comment
JavaScript

3 Comments(s)

Copy linkTweet thisAlerts:
@Khalid_AliMar 20.2005 — yes, that is standard DOM

use

document.getElementById("layerId").style.visibility="hidden";

for all browsers.
Copy linkTweet thisAlerts:
@nyfikenauthorMar 20.2005 — [i]Originally posted by Khalid Ali [/i]

[B]yes, that is standard DOM

use

document.getElementById("layerId").style.visibility="hidden";

for all browsers. [/B]
[/QUOTE]


Thanks for your replay! It worked fine in both Firefox and IE. Maby you have an alternative suggestions for this: document.images[0].src=namn.src;

I use the code to show preloaded images, but it only works with IE. Do you also know why links are underlined in Firefox, but not in IE?

I have this code in a .css file

#text02{font-family:verdana,arial,sans-serif;

font-size:11px;

text-decoration:none;

line-height:16px;

color:#000000;}

Looking forward to hear from you! ?

Nyfiken
Copy linkTweet thisAlerts:
@Khalid_AliMar 20.2005 — instead of

[b]document.images[0].src=namn.src;[/b]

you can use

document.getElementsByTagName("img")[0].src=xxxx

as far as the [b]text-decoration:none;[/b], I am prety sure there is something wrong the way its being implemented, post a link here of the page with the problm. IE usually tries to guess and overlooks small mistakes
×

Success!

Help @nyfiken spread the word by sharing this article on Twitter...

Tweet This
Sign in
Forgot password?
Sign in with TwitchSign in with GithubCreate Account
about: ({
version: 0.1.9 BETA 5.25,
whats_new: community page,
up_next: more Davinci•003 tasks,
coming_soon: events calendar,
social: @webDeveloperHQ
});

legal: ({
terms: of use,
privacy: policy
});
changelog: (
version: 0.1.9,
notes: added community page

version: 0.1.8,
notes: added Davinci•003

version: 0.1.7,
notes: upvote answers to bounties

version: 0.1.6,
notes: article editor refresh
)...
recent_tips: (
tipper: @AriseFacilitySolutions09,
tipped: article
amount: 1000 SATS,

tipper: @Yussuf4331,
tipped: article
amount: 1000 SATS,

tipper: @darkwebsites540,
tipped: article
amount: 10 SATS,
)...