I don’t see jQuery help a lot. I would either document.write them directly, or maybe save them in an XML file
With document.write, it will be something like this (where noscript is removed, since there is no point in having it in the js file
// --- starts jsfile
var embeds = [
'<object width="480" height="385"><param name="movie" value="http://www.youtube.com/v/f8Lp2ssd5A9ErAc&hl=en_US&fs=1&"></param><param name="allowFullScreen" value="true"></param><param name="allowscriptaccess" value="always"></param><embed src="http://www.youtube.com/v/f8Lp2A9ErAc&hl=en_US&fs=1&" type="application/x-shockwave-flash" allowscriptaccess="always" allowfullscreen="true" width="480" height="385"></embed></object>',
'<script type="text/javascript">_qoptions={qacct:"p-3asdb5E0g6"};</script><script type="text/javascript" src="http://edge.quantserve.com/quant.js"></script>'
]; // notice the lack of comma on the last embed
function putEmbed(idx) {
document.write(embeds[idx]);
}
// ------ end ------
and then use
<script type="text/javascript">
putEmbed(0);
</script>
and later
<script type="text/javascript">
putEmbed(1);
</script>
source
share