| | |
Problem Using innerHTML
Please support our JavaScript / DHTML / AJAX advertiser: PostgreSQL or MySQL? Compare and contrast the two most popular open source databases
![]() |
Hi to all I'm new in the forum and this is my first post, I hope, you can help me with the following problem, I have a blank page with a flash object (swf) that plays a FLV movie. I'm trying to remove and return the object when the user clicks on the buttons, the problem is that when I return the object to the page the object is displayed but the movie(FLV) is not played.
I already try using removing and return the element from the DOM, with:
Remove object:
[<container element>].removeChild([<object to append>]);
Return object:
[<container element>].appendChild([<object to append>]);
But this is causing another problems, this is the reason I MUST use the innerHTML method:
This is my page:
JavaScript / DHTML / AJAX Syntax (Toggle Plain Text)
<html> <head> <script> var htmlEmbed =""; function hideObj() { htmlEmbed = document.getElementById('divObj').innerHTML; document.getElementById('divObj').innerHTML = ""; } function showObj() { document.getElementById('divObj').innerHTML = htmlEmbed; } </script> </head> <body> <input type="button" onclick="hideObj()" value="Hide (Embed)" /> <input type="button" onclick="showObj()" value="Show (Embed)" /> <br /> <div id='divObj'> <object id="FlashObjId" name="FlashObjName" classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=+ 9,0,0,0" style="BORDER-RIGHT: 0px; PADDING-RIGHT: 0px; BORDER-TOP: 0px; PADDING-LEFT: 0px; PADDING-BOTTOM: 0px; MARGIN: 0px; OVERFLOW: visible; BORDER-LEFT: 0px; WIDTH: 336px; PADDING-TOP: 0px; BORDER-BOTTOM: 0px; HEIGHT: 280px; textAlign: left"> <PARAM NAME="movie" VALUE="http://www.topfstedt.de/FLVScrubber3/FLVScrubber.swf"> <PARAM NAME="play" VALUE=true'> <PARAM name="allowScriptAccess" value="always"> <PARAM name="allowFullScreen" value=true> <PARAM NAME="menu" VALUE=false> <PARAM NAME="FlashVars" VALUE="file=http://www.nibbler.at/republicofideas.flv&previewImage=http://nibbler.at/republicofideas.jpg"> <PARAM NAME="bgcolor" VALUE="ff00ff"> </object> </div> </body> </html>
Thanks in advanced
Donot use innerHTML to hide or show. But use stype.visibility property to hide or show element.
Your javascript functions then look like this:
Your javascript functions then look like this:
javascript Syntax (Toggle Plain Text)
function hideObj() { document.getElementById('divObj').style.visibility = "hidden"; } function showObj() { document.getElementById('divObj').style.visibility = "visible"; }
When you think you have done a lot, then be ready for YOUR downfall.
![]() |
Similar Threads
- JavaScript + Google Adsense Problem (JavaScript / DHTML / AJAX)
- IE 6 problem with .innerHTML (JavaScript / DHTML / AJAX)
- problem with setTimeout() (JavaScript / DHTML / AJAX)
- Collapsible table sorting problem (JavaScript / DHTML / AJAX)
- JavaScript problem in FF (JavaScript / DHTML / AJAX)
- how to access innerhtml element (JavaScript / DHTML / AJAX)
Other Threads in the JavaScript / DHTML / AJAX Forum
- Previous Thread: Javascript web forms without click
- Next Thread: JavaScript Newbie - problem with style="display:" toggle
| Thread Tools | Search this Thread |
acid2 ajax ajaxexample ajaxjspservlets array browser bug captchaformproblem cart checkbox child class close codes createrange() css cursor date debugger decimal dependent design disablefirebug dom dropdown editor element embed engine enter error events explorer ext file firefox focus form forms frameworks getselection google gxt hiddenvalue highlightedword hint html ie7 ie8 iframe images index internet java javascript javascripthelp2020 jquery jsf jsfile jsp jump libcurl listbox maps masterpage math media menu mp4 object onmouseoutdivproblem onmouseover onreadystatechange parent paypal pdf php position post problem programming progressbar prototype redirect runtime safari scale scriptlets scroll search security shopping size software toggle unicode w3c web wysiwyg \n





