[Javascript] CSS and Javascript

Troy III Ajnej trojani2000 at hotmail.com
Sun Apr 3 11:14:43 CDT 2005


I'm sure you are too bussy with js, that you are forgeting to use the static 
css to define the attributes of the SPAN or whatever.
onload event, will allways fire the command only after the page is loaded 
completely or almost completely. So your span will first get displayed, 
taking its space and then get hidden and the page view will have to reflow, 
it makes you seasick.
Define your span style to display nothing by default and remove the onLoad 
completely. You will not need it anymore.
Keep the function you use to show/hide your SPAN with user actions and 
you're a Go...

>From: "Abyss" <info at abyss.ws>
>Reply-To: "[JavaScript List]" <javascript at LaTech.edu>
>To: "[JavaScript List]" <javascript at LaTech.edu>
>CC: css-d at lists.css-discuss.org
>Subject: [Javascript] CSS and Javascript
>Date: Sun, 3 Apr 2005 19:57:04 +1000
>
>Hi All
>
>Im trying to (with complete failur) to hide a span  when the page loads
>
>but to display it when a certain drop down box menu is selected.
>
>
><span id="soldOrderBlock"></span>
>
>JS code in head
>
>if (document.all)
>    {
>     document.all.soldOrderBlock.style.display='none';
>    }
>    else
>    {
>     document.layers['soldOrderBlock'].style.display='none';
>    }
>
>and calling the JS fuction like this
>
>showHideSelection();
>
>from the head
>
>I do not want to - I cannot - use the onload part of the body because of 
>certain bad design specs..so can anyone see what I am doing wrong?
>
>it works with the onchange on the drop down box, just not when the page 
>loads.
>
>can anyone suggest as to why?
>
>Thanks heaps...
>Abyss
>_______________________________________________
>Javascript mailing list
>Javascript at LaTech.edu
>https://lists.LaTech.edu/mailman/listinfo/javascript

_________________________________________________________________
FREE pop-up blocking with the new MSN Toolbar - get it now! 
http://toolbar.msn.click-url.com/go/onm00200415ave/direct/01/




More information about the Javascript mailing list