We help IT Professionals succeed at work.

Javascript: toggling between a jpeg and a flash movie

John Carney
John Carney asked
on
Medium Priority
230 Views
Last Modified: 2012-06-21
Is it possible to toggle between a jpeg and a flash movie with javascript? PLease take a look at this page and let me know how to do it ... if it's possible.
http://dijitalrealm.com/toggleFlash.html

I suppose this could be facilitated by exporting from flash with certain settings, so I'm putting this in the flash zone as well.

Thanks,

John
Comment
Watch Question

like this?
<html> 
<head> 
<script type="text/javascript"> 
function validate_email(field,alerttxt)
{
with (field)
{
apos=value.indexOf("@");
dotpos=value.lastIndexOf(".");
if (apos<1||dotpos-apos<2) 
  {alert(alerttxt);return false;}
else {return true;}
}
}
 
function validate_form(thisform)
{
with (thisform)
{
if (validate_email(email,"Not a valid e-mail address!")==false)
  {email.focus();return false;}
}
}
</script> 
<script type="text/javascript"> 
function mouseOver()
{
document.getElementById("div1").style.display = "none";
document.getElementById("div2").style.display = "block";
}
function mouseOut()
{
document.getElementById("div2").style.display = "none";
document.getElementById("div1").style.display = "block";
}
</script> 
<style> 
.textBox{width:200px; line-height:16px}
body{margin:40px; font-family: Gill Sans MT; font-size:14px;
}
</style> 
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1"></head> 
 
<body> 
 
<div id="div1" style="position:absolute;top:50px;left:20px;width:200px;height;200px;" onmouseover="mouseOver();" onmouseout="mouseOut();"> 
<a href="http://www.experts-exchange.com/Programming/Languages/Scripting/JavaScript/Q_24156408.html" target="_blank"> 
  <img border="2" alt="Visit W3Schools!" 
 
src="http://dijitalrealm.com/images/beach3.jpg" name="x"
 
 
/> 
  </a>
</div>
<div id="div2" style="display:none;position:absolute;top:50px;left:20px;width:200px;height;200px;" onmouseover="mouseOver();" onmouseout="mouseOut();" >
<object width="200" height="200"> 
<param name="movie" value="http://dijitalrealm.com/flash1.swf"> 
<embed src="http://dijitalrealm.com/flash1.swf" width="200" height="200"> 
</embed> 
</object> 
</div>
 
 
 
</body> 
</html> 

Open in new window

Not the solution you were looking for? Getting a personalized solution is easy.

Ask the Experts
John CarneyReliability Business Tools Analyst II

Author

Commented:
Fantastic!  I love it when the answer is so simple and intuitive.

Thanks, quincydude.

- John
John CarneyReliability Business Tools Analyst II

Author

Commented:
Great answer!
Access more of Experts Exchange with a free account
Thanks for using Experts Exchange.

Create a free account to continue.

Limited access with a free account allows you to:

  • View three pieces of content (articles, solutions, posts, and videos)
  • Ask the experts questions (counted toward content limit)
  • Customize your dashboard and profile

*This site is protected by reCAPTCHA and the Google Privacy Policy and Terms of Service apply.

OR

Please enter a first name

Please enter a last name

8+ characters (letters, numbers, and a symbol)

By clicking, you agree to the Terms of Use and Privacy Policy.