views:

48

answers:

1

I have created some JavaScript files and they run well from my Mac OS X Server. Now I have put the same JavaScript files on my MS Server 2003. But they don't work.

Do I have to install something on the server in order to get them work?

EDIT: (Sorry, I'm new and English is not my native language, so its hard for me to describe the situation well) I have downloaded this free Ajax Chat app. After enabling PHP on my Mac, it worked. But on my MS Windows 2003 Server it doesn't work. I installed PHP and Apache on Windows. PHP and Apache work well. But everything that uses JavaScript (such as drop down menus or pop-up windows) doesn't work.

EDIT2: Ok, this is what I get with Firebug:

invalid XML markup
[Break on this error] var chat_path = <?="'$chat_path'"; ?>;\n
indicator (Zeile 22)
imageButtonAdd is not defined
[Break on this error] <script type="text/javascript"> imageButtonAdd('submit_send'); </script>
indicator (Zeile 70)
invalid XML markup
[Break on this error] img.src = <?="'{$chat_path}colors.png'";?>;\n
indicator (Zeile 121)
imageButtonAdd is not defined
[Break on this error] <script type="text/javascript"> imageButtonAdd('submit_login'); </script>
indicator (Zeile 164)
imageButtonAdd is not defined
[Break on this error] <script type="text/javascript"> imageButtonAdd('submit_glogin'); </script>
indicator (Zeile 193)
dropdown_attach is not defined
[Break on this error] if (document.getElementById("room_pare...om_child", "hover", "y", "default");
indicator (Zeile 207)
invalid XML markup
[Break on this error] img.src = <?="'{$chat_path}smileys/{$pathinfo['basename']}'";?>;\n
indicator (Zeile 227)
invalid XML markup
[Break on this error] img.src = <?="'{$chat_path}smileys/{$pathinfo['basename']}'";?>;\n
indicator (Zeile 232)
invalid XML markup
[Break on this error] img.src = <?="'{$chat_path}smileys/{$pathinfo['basename']}'";?>;\n
indicator (Zeile 237)
invalid XML markup
[Break on this error] img.src = <?="'{$chat_path}smileys/{$pathinfo['basename']}'";?>;\n
indicator (Zeile 242)
invalid XML markup
[Break on this error] img.src = <?="'{$chat_path}smileys/{$pathinfo['basename']}'";?>;\n
indicator (Zeile 247)
invalid XML markup
[Break on this error] img.src = <?="'{$chat_path}smileys/{$pathinfo['basename']}'";?>;\n
indicator (Zeile 252)
invalid XML markup
[Break on this error] img.src = <?="'{$chat_path}smileys/{$pathinfo['basename']}'";?>;\n
indicator (Zeile 257)
invalid XML markup
[Break on this error] img.src = <?="'{$chat_path}smileys/{$pathinfo['basename']}'";?>;\n
indicator (Zeile 262)
chat_api_onload is not defined
[Break on this error] <!DOCTYPE html PUBLIC "-//W3C//DTD XHT...rg/TR/xhtml1/DTD/xhtml1-strict.dtd">
indicator (Zeile 1)
popup_show is not defined
[Break on this error] javascript:popup_show('smiley',%20'smi...20-122,%20%20-210,%20'chat',%20false);
javasc...false); (Zeile 1)
popup_show is not defined
[Break on this error] javascript:popup_show('smiley',%20'smi...20-122,%20%20-210,%20'chat',%20false);
javasc...false); (Zeile 1)
popup_show is not defined

EDIT3: This is what I get on every browser (IE, Firefox, Safari) on Windows:

Windows

And this is what I get on my Mac:

Mac

Thanks!

+1  A: 

When you say "... everything that uses JavaScript ... doesn't work", what behavior do you see? Are you sure the required JavaScript files are loading? What browser are you using? Do you see any errors? Does the server side functionality work and this is just a client side issue?

I would highly recommend using Firebug to make sure the JavaScript files are indeed loading, and check the Firebug console for any JavaScript errors. Edit your question and post any JavaScript errors you see, and that will aid people in answering your question.

EDIT: Based on the JavaScript errors you posted, I see two things:

  1. var chat_path = <?="'$chat_path'"; ?>;. If Firebug/the browser can see PHP tags, it means PHP is either not running or not properly configured. View the page source and see if you see any <?php tags. If you do, PHP isn't running. It could just be the case that PHP short tags are off, and those might need to be turned on.
  2. imageButtonAdd is not defined. This means that the JavaScript function imageButtonAdd is, well, not defined :-) Most likely this is because the JavaScript file for the chat application is not installed properly. View source and look for any <script src="..."> tags and make sure all URLs are valid. Check Firebug's "Net" tab and see if any JavaScript includes are generating 404 Not Found errors.
Josh
Beat me by 22 seconds :) deleting mine.
Pekka
@Pekka haha I should have guessed you were answering when I saw you commenting :-)
Josh
Also, the Firefox "TamperData" extension (or one like it) is handy for checking to see whether targets of `<script>` tags are actually being loaded.
Pointy
1. The browser sees no PHP tags. So PHP should work correctly.2. I checked everything. All URLs are valid! And they must be valid, because the same code works on my Mac... :(
Daniel
@Daniel when you say "the browser sees no PHP tags", does that mean that your firebug copy+past is outdated? Because there are PHP tags in there.
Pekka
@Pekka:Sorry, you are right. There are PHP tags. I just looked for "<?php"...
Daniel
@Daniel the `.js` file extension is probably not being parsed by PHP. If you can, the easiest way would be to rename the files to `.php` and send a header(): `header("Content-type: text/javascript")` so they get interpreted as proper Javascript.
Pekka
Found the problem. I'm so stupid. The short_open_tag was off. o_O Thanks a lot everyone for the help!
Daniel
@Daniel: Ah ha, I thought so! Glad you fixed it :-)
Josh