View Full Version : Nothing executes after confirm box

07-02-2011, 06:11 AM
Hi, when my page loads it starts with a confrim box. If "Cancel" is selected then the rest of the page loads fine. If "Ok" is selected nothing after the confirm box loads. Any ideas.

Also, it appears that IE and Firefox have trouble with this type of media and Chrome will only play the audio file for about 15 seconds. Any solutions?

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">



<title>Justin Revard</title>

<style type="text/css">
html, body {height: 100%; margin: 0; padding: 0;}
#background {position:fixed; top:0; left:0; width:100%; height:100%;}
#content {position:relative; z-index:1;}


<p><img id="background" src="Images/siteBackground.jpg" /></p>
<div id="content">
<h1>Justin Revard's Home Page</h1>
<script type="text/javascript"><!--
var r = confirm("Would you like a background tune?");
if (r == true)
document.body.innerHTML += '<object class="plugin_video" classid="clsid:02BF25D5-8C17-4B23-BC80-D3488ABDDC6B" codebase="http://www.apple.com/qtactivex/qtplugin.cab" height="480" width="640"><param name="autoplay" value="true" /><embed title="QuickTime" hidden="true" src="sounds/siteBG.wav" mce_src="sounds/siteBG.wav autoplay="true" loop="true" controller="true"></embed></object>';
alert("If you change your mind reload the page to choose again.");
// --></script>
<td><a href="Source/page2.html" style="opacity:0">Page 2</a></td>
<td><a href="Source/page3.html" style="opacity:0">Page 3</a><br /></td>
<td><a href="Source/today.php" style="opacity:0">Today's Date</a></td>
<td><a href="Source/morePHP.php" style="opacity:0">More PHP</a></td>
<td><a href="Source/database.php" style="opacity:0">Database</a></td>
<td><a href="source/products.html" style="opacity:0">Products</a></td>
<td><a href="Source/origFileRead.php" style="opacity:0">Original File Reader</a></td>
<td><a href="Source/fileRead.php" style="opacity:0">File Reader</a></td>
<td><a href="http://justinrevard.com"><img src="Images/homeButton.jpg" /></a></td>
<td><a href="foosball.html"><img src="Images/foosballButton.jpg" /></a></td>
<td><a href="physics.html"><img src="Images/physicsButton.jpg" /></a></td>
<td><a href="skiing.html"><img src="Images/skiingButton.jpg" /></a></td>
<td><a href="message.html"><img src="Images/messageButton.jpg" /></a></td>
<td><a href="links.html"><img src="Images/linksButton.jpg" /></a></td>
<td><a href="aboutMe.html"><img src="Images/aboutMeButton.jpg" /></a></td>


07-02-2011, 06:18 AM
you would just be better off setting up a pause function and have the video paused on page load if they want it to play they clcik the play button. im pretty sure you can do that through the object paramaters but I don't know much about flash objects.
it's probably got somethign to do with using innerhtml as opposed to createElement or something similar.
this look sliek what you need - http://www.donatofurlani.it/category/programming/34/js_DOM_Flash_InternetExplorer

Logic Ali
07-02-2011, 06:04 PM
You'll find a missing " in your parameters.