View Full Version : resizing images in NS4
meterlink
10-04-2002, 02:20 PM
Hi,
I need to change 'top' property of the image in NS4 using javascript, but it is read-only. How to do that ? May be to remove and add new image with new sizes ?
Thank you very much
adios
10-04-2002, 04:32 PM
No such property. What was it you needed to do?
requestcode
10-04-2002, 05:24 PM
For Netscape 4 version browsers you will have to place the image inside a div or span tag and use document.write() to rewrite the img tag each time for each image. That is the only way I know of to display multiple images of different sizes in NS4. Here is a sample script for a slideshow that shows how it is done:
<html>
<head>
<title>Imange and Link Slide Show</title>
<SCRIPT LANGUAGE="JavaScript">
var a=0
var count=0
// Set this variable to the speed at which you want the images to change. The speed is in milliseconds.
var speed=10000
var myimages=new Array()
// Enter your images Here along with the directory if need be.
var imgs=new Array()
imgs[0]="nyc12.jpe"
imgs[1]="nyc24.jpe"
imgs[2]="nyc23.jpe"
imgs[3]="nyc14.jpe"
// Preload First Image
myimages[a]=new Image()
myimages[a].src=imgs[a]
count++
window.status="Loaded first image: "+myimages[a]
// Enter your URLS and what you want to go in the ALT property. This is so when they mouse over the image
// There will be a small description of the Image or URL. Make sure you separate them with an
// ampersand "&" so that the script can separate them out before writing out the link.
var urls=new Array()
urls[0]="http://www.requestcode.com&Requestcode"
urls[1]="http://www.javascriptkit.com&Javascriptkit"
urls[2]="http://www.dynamicdrive.com&Dynamic Drive"
urls[3]="http://www.htmlgoodies.com&HTML Goodies"
// This is the function that rotates the images and links. You should not have to modify it.
function Doimglink()
{
// window.status=a
newurls=urls[a].split("&")
if(document.layers)
{
document.mydiv.document.write("<A HREF='"+newurls[0]+"'><IMG SRC='"+imgs[a]+"' BORDER='0' ALT='"+newurls[1]+"'></A>")
document.mydiv.document.close()
}
if(document.getElementById)
{
elm=document.getElementById("mydiv")
elm.innerHTML="<A HREF='"+newurls[0]+"'><IMG SRC='"+imgs[a]+"' BORDER='0' TITLE='"+newurls[1]+"'></A>"
}
a++
if(a>imgs.length-1)
{a=0}
// Preload the next image
if(count<imgs.length)
{
myimages[a]=new Image()
myimages[a].src=imgs[a]
window.status="Loaded "+a+" image: "+myimages[a]
count++
}
setTimeout("Doimglink()",speed)
}
// In the DIV below you may have to add the top and left properties to the style tag to position it
// correctly in the window. You must keep it positions as absolute for it to work in NS4.0+ browsers.
</SCRIPT>
</head>
<body onLoad="Doimglink()">
<DIV ID='mydiv' STYLE="position:absolute"></DIV>
</body>
</html>
vBulletin® v3.8.2, Copyright ©2000-2012, Jelsoft Enterprises Ltd.