This is the weirdest problem I've seen so far. But upfront this is my first javascript development. I've mostly programmed in Actionscript and PHP.

I have quite a bit of javascript running on my PHP page. I had just gotten everything to work well (looking at you IE7!) and I moved one function to another place because out of the blue I was getting "function is not defined."

From there everything went wrong. Soon the page wouldn't register any functions. I moved it all to an external .js file and that solved nothing.

So I went back to where it all went wrong. One by one as I used the page I would get an undefined function error. So I moved these one by one to a different part of the page. Soon I was able to get all the code working but I had my leftover <script> tags.

<link href="css/main.css" rel="stylesheet" type="text/css">
<script type="text/javascript" src="js/jsTrace-uc.js"/>
<script type="text/javascript" src="js/dom-drag.js"/>
[B]<script type="text/javascript">
</script>[/B]
<script type="text/javascript">
  function listHide(boxid){
    document.getElementById(boxid).style.visibility = "hidden";
    document.getElementById(boxid).style.display = "none";
  }
...

So I deleted this and lo and behold, the page stopped working completely again. So I put it back in and it worked!

As I said I haven't done any real Javascript before so I don't really know the nuances of the page structure concerning the scripting environment. But this seems like a very very odd issue.

But it's one of those "how the hell did I ever figure that out."

In case someone is bored and wants to figure this out I've attached the code. I wouldn't mind knowing (for future reference) why in the world this is happening.

It doesn't work because script tags can never be short-tags i.e., <tagname />, they must be explicitly closed i.e., <tagname></tagname>

Thanks! I was just thinking about that this morning. I've been looking at the JS for the problem I just looked it right over.

But those tags have been like that since I put them in and only in the past two days did I get the 'function is not defined' error.

But thanks again. I knew it was something stupidly simple.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.