Heya all,

I've got a really weird bug here at the moment.
I recently uploaded a javascript file form my local dev machine to an IIS server, and it gave me an odd error: "truedocument undefined".

When i looked up the line in my browser source code(the one you get using ctrl-U in firefox), i noticed that all the || parts were missing.

if (document.getElementById("graafwerk").checked == truedocument.getElementById("heetwerk").checked == truedocument.getElementById("explosiemeting").checked == true)

But the source code is like this:

if (document.getElementById("graafwerk").checked == true || document.getElementById("heetwerk").checked == true || document.getElementById("explosiemeting").checked == true)

I should probably add that this happened on an ISS 6.0 machine: not exactly modern no, but that's out of my control.

Phoenix,

First (unlikely but simple), check that the filename on the server has a lower case .js extension.

After that it's likely to be a character encoding issue. If so then it could be caused at any of the following levels:

  • Keyboard - some language settings generate odd codes.
  • Editor - Notepad++ is a safe bet; never use MS Word.
  • FTP upload settings - upload type AUTO is generally safe.
  • Server (IIS) settings

I would check the FTP settings first (), then try opening/saving in a different editor.

If other .js files are served ok, then it's unlikely the server but something to keep in mind. I don't know IIS well enough to advise further.

Airshow

Airshow,
thanks for your reaction.
I checked your notes, but not all of them apply to this document.
First, this page is a combination of ASP and JS, so the file extension is .asp lowercase. Also, it happens on line 892: the rest works fine already.
Now i've combined it with the only page that is going to use it, but that's not working :(

During the development on my workstation i use n++ because the software that my company offers (MS FrontPage) is far less conveniant.
When i run it locally, it goes fine.

Next, i don't connect to the server using FTP, but it's a network machine i can access (so i just have to browse to it).
The network does not (seem to) allow every program to do it: so far i can only access it using Frontpage and explorer.
To cut it short: made in N++, uploaded by frontpage.

As for the settings: i checked the IIS server settings, but they seem to be rather limited (i use a VPN to take control of the server) and i can't find anything i could relate to this problem.
The same goes for frontpage btw.

Finally, when i open the file on my server (using the standard notepad) it shows my two || fine.
I could install n++ on the server, but i doubt the administrator (my boss :P) would be happy to see that.

Mmm, mysterious. I hadn't considered intranet architecture.

It sounds like something peculiar to ASP. I wonder if the guys in the Daniweb ASP.NET forum have come across this?

I think it would be ok to cross-post there as you have drawn a blank here.

Airshow

hmm, i did manage to get the program working, by using 3 seperate IFs that all execute the same few lines of code.
Not very efficient no, but still, can't stay stuck on this forever.

Anyway, i'll wait it out a bit, and then maybe ask around on the ASP form
Thanks for the help, atleast i can sleep in peace, knowing that it's probably microsoft's fault :P

Member Avatar for stbuchok

What editor are you using?

I'm a .Net web application developer that uses JavaScript in pages on a daily basis and have never had this issue.

I used Notepad++ for developing the code: i think i wrote thousands of lines with that program in the past few years, and have to use Frontpage 2003 to upload the code.
(it's an intranet structure that does not allow access to unknown programs, i think)

Phoenix,

Another thought - could you move the code to a separate .js file and include it on the page with <script src="..."></script>? I guess ASP.NET must allow that. Might work.

Airshow

The code was originally in a seperate .js file, but when this error occured i tried inserting it straight into the .asp file.

oh, and it's just plain asp, not asp.net.
Old Skool :)

Phoenix,

Try copying this || and pasting it into the file.

That will sidestep your own keyboard and at least eliminate it.

Airshow

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.