• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 527
  • Last Modified:

How to set the image be auto-resize?

Dear EE experts,

We would like to ask for tech support on where & how to set the images be auto-resize when view in different state of browser. If the browser be maximize, we would like to set the image be maximize its width too.
kindly check the attached embed script for reference:
<head>
<SCRIPT LANGUAGE="JavaScript">

<!-- Begin
// Set up the image files to be used.
var theImages = new Array() // do not change this
// To add more image files, continue with the
// pattern below, adding to the array.

theImages[0] = 'IMG/xg-header-00.jpg'
theImages[1] = 'IMG/xg-header-01.jpg'
theImages[2] = 'IMG/xg-header-02.jpg'
theImages[3] = 'IMG/xg-header-03.jpg'
theImages[4] = 'IMG/IL-header.jpg'

// do not edit anything below this line

var j = 0
var p = theImages.length;
var preBuffer = new Array()
for (i = 0; i < p; i++){
   preBuffer[i] = new Image()
   preBuffer[i].src = theImages[i]
}
var whichImage = Math.round(Math.random()*(p-1));
function showImage(){
document.write('<img src="'+theImages[whichImage]+'">');
}

//  End -->
</script>

</head>

<body>
<tr>
<td>
<SCRIPT LANGUAGE="JavaScript">
    	<!-- Begin
		showImage();
		//  End -->
</script>
</td>
</tr>

Open in new window


Thank you and hope to hear soon...
0
Stiebel Eltron
Asked:
Stiebel Eltron
1 Solution
 
RoonaanCommented:
Have you already experimented with using width='100%' by replacing line 27 from
document.write('<img src="'+theImages[whichImage]+'">');

Open in new window

to
document.write('<img src="'+theImages[whichImage]+'" width="100%" />');

Open in new window

0
 
Stiebel EltronAuthor Commented:
More than 500 pts, can? Excellent!
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

Join & Write a Comment

Featured Post

Ultimate Tool Kit for Technology Solution Provider

Broken down into practical pointers and step-by-step instructions, the IT Service Excellence Tool Kit delivers expert advice for technology solution providers. Get your free copy now.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now