[Javascript] Changing a Div's Style- margin-left in IE5.5

Cutter Bl cutterbl at hotmail.com
Tue Jul 30 07:21:11 CDT 2002


I somewhat agree with Peter. Although I would not use "red" because it may 
be a recognized attribute, it's usually good programming practice to give 
your objects some form of recognizable name. Maybe something like 
'id="idMobileBox"'.

Cutter
Falcon Knives

----Original Message Follows----
From: "Peter Brunone" <peter at brunone.com>
Reply-To: javascript at LaTech.edu
To: <javascript at LaTech.edu>
Subject: RE: [Javascript] Changing a Div's Style- margin-left in IE5.5
Date: Mon, 29 Jul 2002 22:48:56 -0500


	document.all.red.style.marginLeft="100pt";

	For what it's worth, "red" may be a bad name to give an element; I know
it's recognized color in CSS and HTML.  I try to stay away from words that
mean anything when naming my objects... just my two cents, so use it as you
will.

Cheers,

Peter

|-----Original Message-----
|From: javascript-admin at LaTech.edu [mailto:javascript-admin at LaTech.edu]On
|Behalf Of none
|
|What I want to do is move the div element which has the
|image of a red ball in it.  I am trying to do so by
|changing the style's margin-left value to 100 points.
|I am using IE5.5.  Simply stated, I do not know how to
|write the function moveBall.  Will someone please write
|in the correct process for this funciton and give a few
|comments to explain what they did.
|
|<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01
|Transitional//EN"
| "http://www.w3.org/TR/html4/loose.dtd">
|<html><head><title>Move a Ball Once in IE</title>
|<script type="text/javascript1.2">
|<!--
|
|function moveBall( ) {
| document.all['red'].style.margin-left="100pt";
|}
|
|//-->
|</script>
|</head>
|<body>
|<div id="red" style="height:40px; width:40px;
|margin-left:10pt; margin-top:40pt">
|<img src="Ball- red.jpg" height="40" width="40"
|id="redball" name="redball">
|</div>
|<form>
|<input type="button" value="Move Ball" name="move"
|id="move" title="Move" onclick="moveBall( )">
|</form>
|</body>
|</html>
|

_______________________________________________
Javascript mailing list
Javascript at LaTech.edu
https://lists.LaTech.edu/mailman/listinfo/javascript


_________________________________________________________________
Join the world’s largest e-mail service with MSN Hotmail. 
http://www.hotmail.com




More information about the Javascript mailing list