Want to protect your cyber security and still get fast solutions? Ask a secure question today.Go Premium

x
?
Solved

How to set the image be auto-resize?

Posted on 2012-08-16
2
Medium Priority
?
523 Views
Last Modified: 2012-08-19
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
Comment
Question by:Stiebel Eltron
2 Comments
 
LVL 49

Accepted Solution

by:
Roonaan earned 2000 total points
ID: 38304715
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
 

Author Closing Comment

by:Stiebel Eltron
ID: 38310446
More than 500 pts, can? Excellent!
0

Featured Post

Concerto's Cloud Advisory Services

Want to avoid the missteps to gaining all the benefits of the cloud? Learn more about the different assessment options from our Cloud Advisory team.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

By following these Magento e-commerce development tips, you can increase your website's conversion and profitability. Read this post for more details.
No other job is as rewarding and demanding as building an iPhone app is. It is not really in the hands of the developer for the success of an iPhone app. Many factors operate jointly for every iOS application's success in the market.
The viewer will learn how to create and use a small PHP class to apply a watermark to an image. This video shows the viewer the setup for the PHP watermark as well as important coding language. Continue to Part 2 to learn the core code used in creat…
Learn how to create flexible layouts using relative units in CSS.  New relative units added in CSS3 include vw(viewports width), vh(viewports height), vmin(minimum of viewports height and width), and vmax (maximum of viewports height and width).
Suggested Courses

571 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question