Null error in Javascript

Document.getElementById("VideoLayer") is

Page 1 of 1

0 Replies - 944 Views - Last Post: 03 February 2009 - 05:40 AM

#1 EvolutionMedia  Icon User is offline

  • D.I.C Head

Reputation: 3
  • View blog
  • Posts: 125
  • Joined: 11-August 08

Null error in Javascript

Post icon  Posted 03 February 2009 - 05:40 AM

Haven't been on this site for a while! Missed ya guys! :)

Anyways, I created a php script file that outputs html file. However, that's not that main problem. So, I downloaded a tab script from dynamicdrive.com that uses an external html file to read the contents of the subtabs.

I written a javascript function but now it's saying document.getElementById("VideoLayer") is null. I erased the cache from FF and reloaded it. Same thing.

Here's a sample of the function:

<body>

<script language="Javascript">
function PickVideo(vid) {

if(vid == 'MakemeBad35') {



document.getElementById("VideoLayer").style.visibility='visible';
document.getElementById("VideoLayer").innerHTML = "Testing";
 
  }  
}
 
</script>



As you can see it's in the Body. So that shouldn't be the problem. Now when it comes to the tabs I have this:


<div id="mytabsmenu" class="tabsmenuclass">
<ul>
<li><a href="http://www.javascriptkit.com" rel="gotsubmenu[selected]">Javascript Kit</a></li>
<li><a href="http://www.cssdrive.com" rel="gotsubmenu">CSS Drive</a></li>
<li><a href="http://www.codingforums.com">No Sub Menu</a></li>
</ul>
</div>

<div id="mysubmenuarea" class="tabsmenucontentclass">

<!--1st link within submenu container should point to the external submenu contents file-->
<a href="submenucontents.htm" style="visibility:hidden">Sub Menu contents</a>
	<div id="VideoLayer" style="visibility:hidden">
<div id='vu_ytplayer_vjVQa1PpcFMLwjVLggLrsEitwHc53sIBQEc_dP_HF1c='>
<a href='http://www.youtube.com/browse'>Watch the latest videos on YouTube.com</a>
</div>

<script type='text/javascript' src='http://www.youtube.com/watch_custom_player?id=vjVQa1PpcFMLwjVLggLrsEitwHc53sIBQEc_dP_HF1c='>

</script>
</div>
</div>


<script type="text/javascript">
//mouseovertabsmenu.init("tabs_container_id", "submenu_container_id", "bool_hidecontentsmouseout")
mouseovertabsmenu.init("mytabsmenu", "mysubmenuarea", true)

</script>





Inside a Table Column. Watch i bet it jumps out in my face. Everything looks fine. However, maybe the Video Layer is defined in another DIV which is causing a few hiccups. What u think?

Is This A Good Question/Topic? 0
  • +

Page 1 of 1