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: schalk at volume4.com (Schalk Neethling)
  • Subject: [javascript] Question
  • Date: Sun Jul 31 02:51:52 2005

Thanks a million Mr. Alim! It works perfectly. No why didn't I think to 
do that?

S.F. Alim wrote:

>Hi again,
>
>I did an experiment on your script. All you have to do is reverse the
>values... following will be your javascript.
>
>
>        if(style2.display == "none") {
>            style2.display = "block";
>        } else {
>            style2.display = "none";
>        }
>
>        if(expander.width == "75%") {
>            expander.width = "50%";
>        } else {
>            expander.width = "75%";
>        }
>
>These solve your first click trick.
>And please correct me if I am wrong somewhere or anywhere.
>
>Regards,
>S. F. Alim
>Information Unit.
>
>
>
>-----Original Message-----
>From: javascript-bounces@xxxxxxxxxx [mailto:javascript-bounces@xxxxxxxxxx]On
>Behalf Of S.F. Alim
>Sent: Sunday, July 31, 2005 8:56 AM
>To: '[JavaScript List]'
>Subject: RE: [javascript] Question
>
>Hi,
>Well what I am going to tell you might not be an answer but it might help u
>in some way, first of all I am not a javascripter, just a simple css
>designer.
>
>Some one wrote me this javascript just like you
>
>if (style2.display == "block")
> {style2.display = "none";}
>else
> {style2.display = "block";}
>
>
>But for css I have to make element/selector[#left-column] display:none;
>then your script will work on first click.
>
>Otherwise like Mr. Matt said
>
>"Since it's empty, it gets thrown into your else condition".
>
>Regards,
>S. F. Alim
>Information Unit
>
>
>
>
>-----Original Message-----
>From: javascript-bounces@xxxxxxxxxx [mailto:javascript-bounces@xxxxxxxxxx]On
>Behalf Of Schalk Neethling
>Sent: Sunday, July 31, 2005 2:45 AM
>To: javascript@xxxxxxxxxx
>Subject: [javascript] Question
>
>Greetings All!
>
>I have the following bit of javascript:
>
>-- Not posting all just the standards part --
>function toggleLayer(whichLayer, expandedLayer)
>{
>    if (document.getElementById)
>    {
>        // this is the way the standards work
>        var style2 = document.getElementById(whichLayer).style;
>        var expander = document.getElementById(expandedLayer).style;
>
>
>        if(style2.display == "block") {
>            style2.display = "none";
>        } else {
>            style2.display = "block";
>        }
>
>        if(expander.width == "50%") {
>            expander.width = "75%";
>        } else {
>            expander.width = "50%";
>        }
>    }
>
>Now, I have a link as such which calls the script:
><a href="javascript:toggleLayer('left-column', 'center-column');"
>title="Expand/Contract Content">Expand/Contract Content</a>
>
>The I have the following CSS:
>#left-column {
>    position: relative;
>    float:left;
>    display:block;
>    width:25%;
>}
>
>#center-column {
>    position:relative;
>    float:left;
>    width:50%;
>
>}
>
>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!
>
>--
>Kind Regards
>Schalk Neethling
>Web Developer.Designer.Programmer.President
>Volume4.Business.Solution.Developers
>emotionalize.conceptualize.visualize.realize
>Landlines
>Tel: +27125468436
>Fax: +27125468436
>Web
>email:schalk@xxxxxxxxxxx
>Global: www.volume4.com
>Messenger
>Yahoo!: v_olume4
>AOL: v0lume4
>MSN: volume4_@xxxxxxxxxxx
>
>We support OpenSource
>Get Firefox!- The browser reloaded -
>http://www.mozilla.org/products/firefox/
>
>This message contains information that is considered to be sensitive or
>confidential and may not be forwarded or disclosed to any other party
>without the permission of the sender. If you received this message in
>error, please notify me immediately so that I can correct and delete the
>original email. Thank you.
>
>_______________________________________________
>Javascript mailing list
>Javascript@xxxxxxxxxx
>https://lists.LaTech.edu/mailman/listinfo/javascript
>
>
>
>_______________________________________________
>Javascript mailing list
>Javascript@xxxxxxxxxx
>https://lists.LaTech.edu/mailman/listinfo/javascript
>
>
>
>_______________________________________________
>Javascript mailing list
>Javascript@xxxxxxxxxx
>https://lists.LaTech.edu/mailman/listinfo/javascript
>
>
>  
>

-- 
Kind Regards
Schalk Neethling
Web Developer.Designer.Programmer.President
Volume4.Business.Solution.Developers
emotionalize.conceptualize.visualize.realize
Landlines
Tel: +27125468436
Fax: +27125468436
Web
email:schalk@xxxxxxxxxxx
Global: www.volume4.com
Messenger
Yahoo!: v_olume4
AOL: v0lume4
MSN: volume4_@xxxxxxxxxxx

We support OpenSource
Get Firefox!- The browser reloaded - http://www.mozilla.org/products/firefox/
 
This message contains information that is considered to be sensitive or confidential and may not be forwarded or disclosed to any other party without the permission of the sender. If you received this message in error, please notify me immediately so that I can correct and delete the original email. Thank you.