troubleshooting Question

Why does my godaddy web-server serve .htm correctly, but not .js ?

Avatar of James Hancock
James HancockFlag for United States of America asked on
9 Comments1 Solution133 ViewsLast Modified:
I'm surprised that when I put this javascript example (from a coding web-page) in my Godaddy public html folder, it didn't work, - it just printed the code.

Must I do anything special to tell the host that i's not plain text, but it's  actually code..
I have both index.htm and index.js in the same folder
I have the javascript at the bottom, below, but
This is index.htm that works when called from my URL in my browser:

<TITLE>Your Title Here</TITLE>
<a href="">Link Name</a>
is a link to another nifty site
<H1>This is a Header</H1>
<H2>This is a Medium Header</H2>
Send me mail at <a href=""></a>.
<P> This is a new paragraph!
<P> <B>This is a new paragraph!</B>
<BR> <B><I>This is a new sentence without a paragraph break, in bold italics.</I></B>

Open in new window

This is index.js that doesn't work, but just prints the code in the browser...

  <title>Multiplication Table</title>
  <script type="text/javascript">
    var rows = prompt("How many rows for your multiplication table?");
    var cols = prompt("How many columns for your multiplication table?");
    if(rows == "" || rows == null)
   		 rows = 10;
    if(cols== "" || cols== null)
   		 cols = 10;
    createTable(rows, cols);
    function createTable(rows, cols)
      var j=1;
      var output = "<table border='1' width='500' cellspacing='0'cellpadding='5'>";
    	output = output + "<tr>";
  		  output = output + "<td>" + i*j + "</td>";
   		  j = j+1;
   		 output = output + "</tr>";
   		 j = 1;
    output = output + "</table>";

Open in new window

What might I be missing to have the browsers load the javascript?
Join our community to see this answer!
Unlock 1 Answer and 9 Comments.
Start Free Trial
Learn from the best

Network and collaborate with thousands of CTOs, CISOs, and IT Pros rooting for you and your success.

Andrew Hancock - VMware vExpert
See if this solution works for you by signing up for a 7 day free trial.
Unlock 1 Answer and 9 Comments.
Try for 7 days

”The time we save is the biggest benefit of E-E to our team. What could take multiple guys 2 hours or more each to find is accessed in around 15 minutes on Experts Exchange.

-Mike Kapnisakis, Warner Bros