G
Ghyslaine Crespe
Hello,
In my script, the line
document.getElementById(id).style.background-position = "-200px -500px";
fails !
So, how can I change the background-position value ?
Thanks, Denis
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML>
<HEAD>
<TITLE> New Document </TITLE>
<META NAME="Generator" CONTENT="EditPlus">
<META NAME="Author" CONTENT="">
<META NAME="Keywords" CONTENT="">
<META NAME="Description" CONTENT="">
<style>
div.hr {
border: solid #0000FF;
display: inline;
height: 600px;
width: 300px;
background-image: url(plan_station.gif);
background-repeat: no-repeat;
background-position: -100px -400px;
margin: 0em 0 0em 0;
}
</style>
<SCRIPT LANGUAGE="JavaScript" TYPE="text/javascript">
function goRight(id)
{
document.getElementById(id).style.height="100px";
document.getElementById(id).style.background-position = "-200px -500px";
}
</SCRIPT>
</HEAD>
<BODY>
<a href="#" onclick="goRight('myDiv')">right</a>
<DIV id="myDiv" class = "hr" ></DIV>
</BODY>
</HTML>
In my script, the line
document.getElementById(id).style.background-position = "-200px -500px";
fails !
So, how can I change the background-position value ?
Thanks, Denis
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML>
<HEAD>
<TITLE> New Document </TITLE>
<META NAME="Generator" CONTENT="EditPlus">
<META NAME="Author" CONTENT="">
<META NAME="Keywords" CONTENT="">
<META NAME="Description" CONTENT="">
<style>
div.hr {
border: solid #0000FF;
display: inline;
height: 600px;
width: 300px;
background-image: url(plan_station.gif);
background-repeat: no-repeat;
background-position: -100px -400px;
margin: 0em 0 0em 0;
}
</style>
<SCRIPT LANGUAGE="JavaScript" TYPE="text/javascript">
function goRight(id)
{
document.getElementById(id).style.height="100px";
document.getElementById(id).style.background-position = "-200px -500px";
}
</SCRIPT>
</HEAD>
<BODY>
<a href="#" onclick="goRight('myDiv')">right</a>
<DIV id="myDiv" class = "hr" ></DIV>
</BODY>
</HTML>