Problem Using innerHTML

Please support our JavaScript / DHTML / AJAX advertiser: PostgreSQL or MySQL? Compare and contrast the two most popular open source databases
Reply

Join Date: Dec 2008
Posts: 1
Reputation: Omer.Registry is an unknown quantity at this point 
Solved Threads: 0
Omer.Registry's Avatar
Omer.Registry Omer.Registry is offline Offline
Newbie Poster

Problem Using innerHTML

 
0
  #1
Dec 1st, 2008

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)
  1. <html>
  2. <head>
  3. <script>
  4. var htmlEmbed ="";
  5. function hideObj()
  6. {
  7. htmlEmbed = document.getElementById('divObj').innerHTML;
  8. document.getElementById('divObj').innerHTML = "";
  9. }
  10.  
  11. function showObj()
  12. {
  13. document.getElementById('divObj').innerHTML = htmlEmbed;
  14. }
  15. </script>
  16.  
  17. </head>
  18.  
  19. <body>
  20.  
  21. <input type="button" onclick="hideObj()" value="Hide (Embed)" />
  22. <input type="button" onclick="showObj()" value="Show (Embed)" />
  23.  
  24. <br />
  25.  
  26. <div id='divObj'>
  27.  
  28. <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">
  29. <PARAM NAME="movie" VALUE="http://www.topfstedt.de/FLVScrubber3/FLVScrubber.swf">
  30. <PARAM NAME="play" VALUE=true'>
  31. <PARAM name="allowScriptAccess" value="always">
  32. <PARAM name="allowFullScreen" value=true>
  33. <PARAM NAME="menu" VALUE=false>
  34. <PARAM NAME="FlashVars" VALUE="file=http://www.nibbler.at/republicofideas.flv&previewImage=http://nibbler.at/republicofideas.jpg">
  35. <PARAM NAME="bgcolor" VALUE="ff00ff">
  36. </object>
  37.  
  38. </div>
  39.  
  40. </body>
  41. </html>
  42.  


Thanks in advanced
Reply With Quote Quick reply to this message  
Join Date: Aug 2006
Posts: 319
Reputation: Luckychap is on a distinguished road 
Solved Threads: 42
Luckychap's Avatar
Luckychap Luckychap is offline Offline
Posting Whiz

Re: Problem Using innerHTML

 
0
  #2
Dec 1st, 2008
Donot use innerHTML to hide or show. But use stype.visibility property to hide or show element.

Your javascript functions then look like this:

  1. function hideObj()
  2. {
  3. document.getElementById('divObj').style.visibility = "hidden";
  4. }
  5.  
  6. function showObj()
  7. {
  8. document.getElementById('divObj').style.visibility = "visible";
  9. }
When you think you have done a lot, then be ready for YOUR downfall.
Reply With Quote Quick reply to this message  
Reply

This thread is more than three months old.
Perhaps start a new thread instead?
Message:



Similar Threads
Other Threads in the JavaScript / DHTML / AJAX Forum
Thread Tools Search this Thread



About Us | Contact Us | Advertise | DaniWeb | Acceptable Use Policy | RSS Feed

©2003 - 2009 DaniWeb® LLC