sniperman
10-04-2009, 02:54 PM
Hi,
I've been working on a solution for a couple of hours now with little result.
The basic action I want javascript to do on an event is to change the css margin-right property of an anchor element.
The HTML
<a name="selector1" id="selector1" href="#" onmouseover="select('1')" onmouseout="deselect('1')"><img src="image.gif" /></a>
The CSS
margin-right:-135px;
The javascript
function select(prop) {
link = document.getElementById('selector'+[prop]); // selects the element for manipulation
link.style.cssText = "margin-right:-160px;";
}
or possibly
function select(prop) {
link = document.getElementById('selector'+[prop]); // selects the element for manipulation
link.style.marginRight="32px";
}
neither of these solutions work. I work with IE7 and it doesn't pick up CSS's margin-right. The attribute shows up in Firebug but nothing happens on the screen.
I've been working on a solution for a couple of hours now with little result.
The basic action I want javascript to do on an event is to change the css margin-right property of an anchor element.
The HTML
<a name="selector1" id="selector1" href="#" onmouseover="select('1')" onmouseout="deselect('1')"><img src="image.gif" /></a>
The CSS
margin-right:-135px;
The javascript
function select(prop) {
link = document.getElementById('selector'+[prop]); // selects the element for manipulation
link.style.cssText = "margin-right:-160px;";
}
or possibly
function select(prop) {
link = document.getElementById('selector'+[prop]); // selects the element for manipulation
link.style.marginRight="32px";
}
neither of these solutions work. I work with IE7 and it doesn't pick up CSS's margin-right. The attribute shows up in Firebug but nothing happens on the screen.