...

View Full Version : cant get the page to load unexpanded



jzo
12-21-2011, 09:09 PM
so when the page is initially opened, i dont want the video to be showing until the preview button is clicked.

<!DOCTYPE html>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<title>Christmas Greets!</title>
<script type="text/javascript">
<!--
function switchMenu(obj) {
var el = document.getElementById(obj);
if ( el.style.display != "none" ) {
el.style.display = 'none';
}
else {
el.style.display = '';
}
}
//-->
</script>
</head>

<body>
<div id="wrapper">
<img src="somepicture.png"
<p><a onclick="switchMenu('myvar');" title="View Greeting"><button>Preview</button></a></p>
<div id="myvar">
<video width="240" height="160" controls="controls">
<source src="EatResponsibly.mp4" type="video/mp4" />
<source src="EatResponsibly.ogv" type="video/ogv" />
<source src="EatResponsibly.webm" type="video/webm" />
You Browser Does not Support This Video.
Please Update Your Browser.
</video>
</div>
</div>
</body>
</html>

jzo
12-21-2011, 09:58 PM
any ideas? im not a great javascript programmer, im better at php haha

chump2877
12-21-2011, 10:05 PM
Something like this (I did not test this):


<!DOCTYPE html>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<title>Christmas Greets!</title>
<script type="text/javascript">
function toggleContent(id)
{
var el = document.getElementById(id);
el.style.display = (el.style.display == "block") ? "none" : "block";
}
</script>
</head>

<body>
<div id="wrapper">
<img src="somepicture.png"
<p><input type="button" value="Preview" onclick="toggleContent('myvar')" /></p>
<div id="myvar" style="display:none">
<video width="240" height="160" controls="controls">
<source src="EatResponsibly.mp4" type="video/mp4" />
<source src="EatResponsibly.ogv" type="video/ogv" />
<source src="EatResponsibly.webm" type="video/webm" />
You Browser Does not Support This Video.
Please Update Your Browser.
</video>
</div>
</div>
</body>
</html>

jzo
12-21-2011, 10:17 PM
Great ! Slapblyself.in the for head for that one..overthinking



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum