Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Javascript won't load Flash in Firefox

Status
Not open for further replies.

johnckeogh

Programmer
Sep 1, 2003
2
GB
Hi

I have written a small piece of code that works fine in ie but not in Firefox. The user can click on a text field and the .swf file in that field will be loaded using a javascript function. Any ideas as to why this isn't working in Firefox would be most appreciated. Here is the code below.

<Script Language=JavaScript>

function showSWFPreview(currSWF){

var isSelection = currSWF;
var flashObjStr = "<object type=application/x-shockwave-flash width='720' height='480' class='movie' loop=false><PARAM NAME=Movie value="+isSelection+"></object>"
document.getElementById('video_main').innerHTML = flashObjStr;
/*alert(document.getElementById('video_main').innerHTML);*/
alert(currSWF);
}

</Script>

</head>

<body>
<div id="container">
<div id="hadder_nav"></div>
<div id="hadder_cont"></div>
<div id="video_top"></div>
<div id="video_main">

</div>


<div id="lesson_sp"><input type="text" value="Seq1.swf" size="100" onclick="showSWFPreview(this.value)"></div>

Thanks
 
Get your page validating (with a complete doctype) first. Then install the (free) Firebug extension for Firefox and find out if any Javascript errors are being reported.

As things stand right now (with what you have posted), the DOM is not complete. The div with id="container" is never closed.

The script tags should look like this:
Code:
<script type="text/javascript">...</script>
There is no need to use the (deprecated) language attribute, and remember that the case of tag names should be consistent (all upper, or all lower - depending on what your doctype will allow, but not a mix of upper and lower).

Hope those things get you off to a good start... let us know how you go, and if there are any problems stemming from this.

Cheers,
Jeff

[tt]Jeff's Blog [!]@[/!] CodeRambler
[/tt]

Make sure your web page and css validates properly against the doctype you have chosen - before you attempt to debug a problem!

FAQ216-6094
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top