| Sign In/My Account | View Cart |
| Article: |
Hi-Res YouTube Hacks | |
| Subject: | Browser Compatibility | |
| Date: | 2008-05-14 10:05:57 | |
| From: | DavidBattino | |
|
Response to: Browser Compatibility
|
||
| Curses. Thanks for checking that out. I wonder — what if we set the height and width in the div as well as the placeholder image? Perhaps that would prevent the area from collapsing as the image is swapped out. | ||
Showing messages 1 through 5 of 5.
Browser Compatibility
function viewTube(triggerID,movieURL,movieWth,movieHt) {
var div = document.createElement('div'); //Create DIV variable
var embedcode = "<object width='" + movieWth + "&autostart=1' height='" + movieHt + "'>";
embedcode += "<param name='movie' value='" + movieURL + "'></param>";
embedcode += "<param name='wmode' value='transparent'></param>";
embedcode += "<embed src='" + movieURL + "&autoplay=1' type='application/x-shockwave-flash' wmode='transparent' width='" + movieWth + "' height='" + movieHt + "'></embed></object>";
div.innerHTML = embedcode; //Assign embedcode to DIV variable
document.getElementById(triggerID).innerHTML = ""; //Clear DIV
document.getElementById(triggerID).insertBefore(div,null); //Insert new DIV content
}
Javascript Function
function flipMoviePoster(divIdOne,divIdTwo)
{
document.getElementById(divIdOne).style.display = 'none';
document.getElementById(divIdTwo).style.display = '';
}
Body
<div id="poster" align="center" onclick="flipMoviePoster(this.id,this.id+'2')" style="cursor:pointer;">
<img src="SAN_Provo_002.jpg" alt="Click to Play" width="425" height="355" border="0" />
</div>
<div id="poster2" align="center" style="display:none;">
<object width="425" height="355">
<param name="movie" value="http://www.youtube.com/v/5cwjKwe7a5s&hl=en&ap=%2526fmt%3D18&autostart=1"></param>
<param name="wmode" value="transparent"></param>
<embed src="http://www.youtube.com/v/5cwjKwe7a5s&hl=en&ap=%2526fmt%3D18&autoplay=1"
type="application/x-shockwave-flash" wmode="transparent" width="425" height="355"></embed>
</object>
</div>
</body>
</html>