Inserting your SWF with Javascript

Hey Kirupa

Does anyone know the theory behind using javascript to insert your SWF files into the XHTML page, rather then the ("Insert…, Media…, SWF) way.

Is this a better way of doing it? whats the difference?

the Java looks like this:

<script type=“text/javascript”>
A[
var so = new SWFObject(“here.swf”, “”, “100%”, “100%”, “9”, “#000000”);
so.addParam(“scale”, “noscale”);
so.addParam(“salign”, “tl”);
so.addParam(“wmode”,“opaque”);
so.write(“flash”);

</script>

Also what is this script used for:

<script type=“text/javascript”>
var gaJsHost = ((“https:” == document.location.protocol) ? “https://ssl.” : “http://www.”);
document.write(unescape("%3Cscript src=’" + gaJsHost + “google-analytics.com/ga.js’ type=‘text/javascript’%3E%3C/script%3E”));
</script>

I keep seeing this around.

Thank for your time

kym