[Okta Webinar] Learn how to a build a cloud-first strategyRegister Now

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 160
  • Last Modified:

Javascript Random image shows 2 images at once?

One of my designers is trying to make something simple work - and is using the following code-- the goal is:  each time the page is refreshed, a different image will appear. (there are only two images)

What is happening is that when page is refreshed, both images show - instead of one. Can you tell what is wrong?  

<table width="771" height="341" border="0" align="center" cellpadding="0" cellspacing="0">
<tr>
<td width="771"><img src="../Documents/QuoVardis/QV_web_07/images/oasis.jpg" width="771" height="341"></td>


<script language="JavaScript1.1">
<!--
document.Quo Vadis Travel.src="../Documents/QuoVardis/QV_web_07/images/DSCN1599_crop.jpg"+Math.round(Math.random()*6+.5)+".jpg";
//-->
</script>
0
webguy62
Asked:
webguy62
1 Solution
 
amit_gCommented:
The script is trying to change the image with ID as "Quo Vadis Travel". The spaces in the ID would make this statement invalid. So if you check the javascript errors in your browser, you should see error. Also the HTML you posted is not being affected as there is nothing with that ID in it. If you want us to make suggestions, post where exactly you want that image to go and what are the exact image names.
0

Featured Post

Concerto Cloud for Software Providers & ISVs

Can Concerto Cloud Services help you focus on evolving your application offerings, while delivering the best cloud experience to your customers? From DevOps to revenue models and customer support, the answer is yes!

Learn how Concerto can help you.

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