现在我想要的是始终显示#youtube,但是如果您单击它,我想将其转换为#embed。不能让它工作。我的意思是它不做我刚才解释的事情。什么都没发生。
<div id="youtube" onclick="replace()" style="display:block">
<img src="http://img.youtube.com/vi/'.$id.'/1.jpg">
<span class="title"><font color="#999">YouTube™ Video:</font> '.$title.'</span>
<span class="views">Views: '.number_format($views).'</span>
<span class="description">'.$desc.'</span>
</div>
// show this only if they clicked on #youtube
<div id="embed" onclick="replace()" style="display:none">
<object width="425" height="344">
<param name="movie" value="http://www.youtube.com/v/$1?fs=1"</param>
<param name="allowFullScreen" value="true"></param>
<param name="allowScriptAccess" value="always"></param>
<embed src="http://www.youtube.com/v/$1?fs=1"
type="application/x-shockwave-flash" allowscriptaccess="always" allowFullScreen="true" width="425" height="344">
</embed>
</object>
</div>
JS:
function replace() {
document.getElementById(youtube).style.display="none";
document.getElementById(embed).style.display="block";
}