/    Sign up×
Community /Pin to ProfileBookmark

[RESOLVED] Any ideas about JS or CSS problem.

I posted this link on the CSS forum
[url]http://www.webdeveloper.com/forum/showthread.php?t=150040[/url]
but I still don’t know if it a JS or CSS problem.

Anybody have any ideas?
Thanks.

to post a comment
JavaScript

3 Comments(s)

Copy linkTweet thisAlerts:
@redhatlookJun 01.2007 — 1) In my browser is that div initially hidden. (both ie/ff)

2) Anyway 1st click really does nothing, but if you place the alert in your Toggle function this way:


function Toggle(Info) {

CState = document.getElementById(Info);

alert(CState.style.display);

if (CState.style.display == "none") { CState.style.display = "block"; }

else { CState.style.display = "none"; }

}
[/QUOTE]


you will see, that CState.style.display is empty, i don't know why don't ask me ?, so your solution is this:


function Toggle(Info) {

CState = document.getElementById(Info);

if (CState.style.display == "none" || CState.style.display == '') CState.style.display = "block";

else CState.style.display = "none";

}
[/QUOTE]
Copy linkTweet thisAlerts:
@JMRKERauthorJun 01.2007 — Thanks 'redhatlook', I'll give that a try.
Copy linkTweet thisAlerts:
@JMRKERauthorJun 01.2007 — I don't understand why, but it works as expected without the extra 'style=' entries for each <div> and without the extra mouse click.

Thanks again 'redhatlook'. I had not thought about checking the initial state of the style element. Sort of goes against the logic of setting it in the <style..> tag area to cascade down, but what the heck!
×

Success!

Help @JMRKER 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 4.29,
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: @Yussuf4331,
tipped: article
amount: 1000 SATS,

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

tipper: @Samric24,
tipped: article
amount: 1000 SATS,
)...