I have 1 script between <head> </head> --------------------------------------------------------------------------- <script type="text/javascript"> function(){ if(!NiftyCheck()) return; RoundedTop("div#nav li","transparent","#0099FF"); } </script> -------------------------------------------------------------------------- and i have another onload which is <body onload="InitPlayer();"> like this niftycheck is not working!How can i fix this problem?
well firstly the function needs a name so this: function(){ Code (markup): should be like function InitPlayer() { Code (markup): that may not fix it but you can't have a function with no name
<script type="text/javascript"> window.onload = InitPlayer; function InitPlayer() { if(!NiftyCheck()) { return; } RoundedTop("div#nav li","transparent","#0099FF"); } … </script> Code (markup): cheers, gary
Not quite true. There is something called an anonymous function, i.e., no name. For example, you might set the onclick handler so that certain links will cause a new window to open for the target url. window.onload = addhandler; function addhandler() { if (! document.getElementsByTagName) { return false; } var links = document.getElementsByTagName("a"); for (var i = 0; i < links.length; i++) { if (links[i].rel == "ext") { links[i].onclick = [color=red]function()[/color] { return ! window.open(this.href); } } } } Code (markup): cheers, gary