OT: Weird Javascript Code

JavaScript and client side scripting.

Moderator: General Moderators

Post Reply
HUWUWA
Forum Commoner
Posts: 35
Joined: Sat Aug 17, 2002 7:24 pm
Location: Long Island, NY

OT: Weird Javascript Code

Post 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.
dusty
Forum Contributor
Posts: 122
Joined: Sun Apr 28, 2002 9:52 pm
Location: Portsmouth, VA

Post 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
jason
Site Admin
Posts: 1767
Joined: Thu Apr 18, 2002 3:14 pm
Location: Montreal, CA
Contact:

Post 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.
dusty
Forum Contributor
Posts: 122
Joined: Sun Apr 28, 2002 9:52 pm
Location: Portsmouth, VA

Post by dusty »

durr, didn't read the full post. add rightmargin="0" in the body tag
User avatar
hob_goblin
Forum Regular
Posts: 978
Joined: Sun Apr 28, 2002 9:53 pm
Contact:

Post by hob_goblin »

Code: Select all

<style type="text/css">
<!--
body&#123;margin:0;&#125;
-->
</style>
should be better...
HUWUWA
Forum Commoner
Posts: 35
Joined: Sat Aug 17, 2002 7:24 pm
Location: Long Island, NY

Post by HUWUWA »

You guys are the best !

:)
HUWUWA
Forum Commoner
Posts: 35
Joined: Sat Aug 17, 2002 7:24 pm
Location: Long Island, NY

Post 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.
User avatar
phice
Moderator
Posts: 1416
Joined: Sat Apr 20, 2002 3:14 pm
Location: Dallas, TX
Contact:

Post by phice »

This should be moved to Client-Side section.
Image Image
User avatar
twigletmac
Her Royal Site Adminness
Posts: 5371
Joined: Tue Apr 23, 2002 2:21 am
Location: Essex, UK

Post 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
dusty
Forum Contributor
Posts: 122
Joined: Sun Apr 28, 2002 9:52 pm
Location: Portsmouth, VA

Post 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 :?
User avatar
phice
Moderator
Posts: 1416
Joined: Sat Apr 20, 2002 3:14 pm
Location: Dallas, TX
Contact:

Post 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;">
Image Image
dusty
Forum Contributor
Posts: 122
Joined: Sun Apr 28, 2002 9:52 pm
Location: Portsmouth, VA

Post by dusty »

phice i think you replied to the wrong post 8O
Post Reply