Links

Lists

Latest Updates

Ruby On Rails List
Python list
Advanced Java
The JavaScript List
Apache Users
Full Disclosure
Linux Security

Search the archives!


[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[javascript] Question


  • From: mwarden at gmail.com (Matt Warden)
  • Subject: [javascript] Question
  • Date: Sat Jul 30 20:13:44 2005

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Schalk Neethling wrote:
> Now, after all that. The problem is, the first time I click the link
> nothing happens. After that it works perfectly. I am new to javascript
> and I am sure I am overlooking something. Any help or pointers will be
> much appreciated. Thank you in advance!

I am pretty sure that .style is a reference to the style attribute of
the element. So, the first time you call the function, style.display
is empty if it is not defined in the element as such:

<foo style="display: block;"></foo>

And, since it's empty, it gets thrown into your else condition, when
then assigns: style2.display = 'block'. Now, the next time you call
the function, the .style.display property will indeed equal 'block'.


- --
Matt Warden
Miami University
Oxford, OH, USA
http://mattwarden.com


This email proudly and graciously contributes to entropy.
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.2.4 (GNU/Linux)

iD8DBQFC7CXAAQ0d4HGyPE8RAnBGAJ9+FbhzYJ0nN6yDAxPtMtkyx6KXtwCfWhHs
x8bB83IthT3usVFERHYJD7w=
=Yi/6
-----END PGP SIGNATURE-----