Page 1 of 1

OT: Weird Javascript Code

Posted: Thu Sep 12, 2002 3:34 pm
by HUWUWA
Hi guys, I wrote OT for off-topic so don't get mad at me.

What the hell does this line of code mean ?

<script language="JavaScript" src="/homepage/toolbar.js"></script>

Here is why I ask. I use <BODY LEFTMARGIN=0 TOPMARGIN=0> then make a <TABLE WIDTH=100%> to make a different color area at the top of the screen. Now when I load the page there is about a 16 pixel gap on the right hand side, but when I hit Refresh it spans the whole horizontal area like it should.

This problem drove me crazy. I looked at some source from the Microsoft site and found that if I add that little script above it works fine without having to Refresh.

What the hell is going on ? Also, does anyone know of a really good JavaScript forum of the same caliber as this PHP forum ?

Thanks guys.

Posted: Thu Sep 12, 2002 3:38 pm
by dusty
the javascript is just stored in a file called toolbar.js rather than placed between the script tags


http://forums.devshed.com/forumdisplay.php?forumid=1

Posted: Thu Sep 12, 2002 3:52 pm
by jason
HUWUWA: The reason it leaves the pixels uncovered is incase it needs that room for the scroll bar. On the initial load, it doesn't know if the page will need a scroll bar, but on the refresh it knows whether it needs the scroll bar or not.

Posted: Thu Sep 12, 2002 3:55 pm
by dusty
durr, didn't read the full post. add rightmargin="0" in the body tag

Posted: Thu Sep 12, 2002 3:58 pm
by hob_goblin

Code: Select all

<style type="text/css">
<!--
body&#123;margin:0;&#125;
-->
</style>
should be better...

Posted: Thu Sep 12, 2002 4:58 pm
by HUWUWA
You guys are the best !

:)

Posted: Thu Sep 12, 2002 8:20 pm
by HUWUWA
Hi again,

Hobgoblin's method seems to be the best but do you think I should also use the <BODY LEFTMARGIN=0 RIGHTMARGIN=0...> just to be safe ?

I don't check browser types and want to make sure the page looks right. For example, can WebTV use style sheets ? I test all my stuff on IE.

Thanks again.

Posted: Thu Sep 12, 2002 8:29 pm
by phice
This should be moved to Client-Side section.

Posted: Fri Sep 13, 2002 1:58 am
by twigletmac
Yeah you really don't need to mark a thread as off topic in the PHP forum when there's a clientside forum where this would be totally on topic... :roll:

Mac

Posted: Fri Sep 13, 2002 11:45 am
by dusty
how would using style be better? i figured they'd both have the same effect, but i would think the body tag would work with pretty much any browser :?

Posted: Fri Sep 13, 2002 2:01 pm
by phice
CSS would be much easier on you. But, if you want two different input tags to have different colors, then I would do...

Code: Select all

<input type="text" name="jdsf" style="background: COLOR;">

Posted: Fri Sep 13, 2002 2:30 pm
by dusty
phice i think you replied to the wrong post 8O