D
Doug van Vianen
Hi,
I am trying to show a clipped part of a picture on a webpage and
move it on the page and/or change the clipping to a different part
of the picture. I show the picture in the body of the page by
using
<div id=div1 style="position:absolute; top:200; left:400; width:200;
height:200; z-index:1; background-image:url(ole01.jpg);
clip:rect(0,150,50,100)"></div>
This shows the appropriate clipped part of the picture at the correct
location. I try to use the following Javascript code in the head to
change the position of the picture clip:
<script language="JavaScript">
<!--
function Dochange(ident) {
var ref=document.getElementById(ident);
ref.style.left=300;
}
-->
</script>}
and the following button in a form:
<input type="submit" name="Change" value="Change" size=20
onClick="Dochange('div1')">
The code is accessed when the button is clicked (I used an alert to
check this), but nothing happens to the position of the clipped
picture and no error message appears. Can someone help me?
When I get this working I would like to add any statements necessary
in the Javascript to change the clipping area. Would it be something
like
ref.style.clip:rect(0,50,50,0);
or what?
Thank you.
Doug van Vianen
(e-mail address removed)
I am trying to show a clipped part of a picture on a webpage and
move it on the page and/or change the clipping to a different part
of the picture. I show the picture in the body of the page by
using
<div id=div1 style="position:absolute; top:200; left:400; width:200;
height:200; z-index:1; background-image:url(ole01.jpg);
clip:rect(0,150,50,100)"></div>
This shows the appropriate clipped part of the picture at the correct
location. I try to use the following Javascript code in the head to
change the position of the picture clip:
<script language="JavaScript">
<!--
function Dochange(ident) {
var ref=document.getElementById(ident);
ref.style.left=300;
}
-->
</script>}
and the following button in a form:
<input type="submit" name="Change" value="Change" size=20
onClick="Dochange('div1')">
The code is accessed when the button is clicked (I used an alert to
check this), but nothing happens to the position of the clipped
picture and no error message appears. Can someone help me?
When I get this working I would like to add any statements necessary
in the Javascript to change the clipping area. Would it be something
like
ref.style.clip:rect(0,50,50,0);
or what?
Thank you.
Doug van Vianen
(e-mail address removed)