Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations IamaSherpa on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Image Positioning and Sizing

Status
Not open for further replies.

JohnLeeke

Technical User
Sep 5, 2001
2
US
How do I adapt the following javascript code:

********
<img src="officecam0000.jpg" name="myImageName">

<script language="JavaScript">
function reloadImage() {
var now = new Date();
if (document.images) {
document.images.myImageName.src = 'officecam0000.jpg?' + now.getTime();
}
setTimeout('reloadImage()',10000);
}

setTimeout('reloadImage()',10000);
</script>
***********

so that it positions and sizes the image the same as this html code:

********
<p align="left"><img border="0" src="officecam0000.jpg" width="150" height="130"><br>
OfficeCam(10sec.update)</p>
*********

You can see where I am using this code at:


I am new to javascript, so you may have to spell it out for me.



Thanks for your help.

John
 
Looks like you just need to give your image (I mean the one inside a paragraph that is sized) a name attribute like the one in the first bit of example code.

Code:
<p align="left"><img border="0" src="officecam0000.jpg" width="150" height="130" name="myImageName"><br>
OfficeCam(10sec.update)</p>

Unless there's some particular reason you want to set the position and size of the image from within the script?
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top