Search the archives!
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Javascript] Changing a Div's Style- margin-left in IE5.5
- From: javascript@xxxxxxxxxx (Peter Brunone)
- Subject: [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@xxxxxxxxxx [mailto:javascript-admin@xxxxxxxxxx]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> |
- References:
- Prev by Date: [Javascript] (no subject)
- Next by Date: [Javascript] Open page in frame from popup window
- Previous by thread: [Javascript] Changing a Div's Style- margin-left in IE5.5
- Next by thread: [Javascript] Changing a Div's Style- margin-left in IE5.5
- Index(es):