[solved] <script> tags stopping display

JavaScript and client side scripting.

Moderator: General Moderators

Post Reply
User avatar
pickle
Briney Mod
Posts: 6445
Joined: Mon Jan 19, 2004 6:11 pm
Location: 53.01N x 112.48W
Contact:

[solved] <script> tags stopping display

Post by pickle »

Hi folks,

Here's an odd one: I've got an XHTML 1.0 Strict validating document set up. When I put <script> tags inside my <body> tags & a couple <div> tags, everything before the <script> tags doesn't get displayed. The page still validates with the <script> tags in there, but neither Firefox nor IE7 seem to like it too much. The code inside the <script> tags is JQuery specific, but when I remove that code entirely, I still have the problem. If I move the <script> tags above my login form, the login form gets displayed, but the navigation & header areas still remain ... in limbo somewhere.

The page is shown below:

Code: Select all

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
        "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
    <title>
      WASSAIL: 
    </title>
    <meta http-equiv="content-type" content="text/html;charset=utf-8" />
      <link rel = "stylesheet" type = "text/css" href = "templates/style.css"/>
	<script type = "text/javascript" src = "include/jquery-1.2.1.min.js" />
</head>
<body>
    <div id = "background-left">
    </div>
    <div id = "body">
      <div id = "header">
	WASSAIL: 
      </div>
      <div id = "navigation">
	      </div>
      <div id = "content">      <div id = "login-box" class = "dialog">
	<form method = 'post' action = 'index.php'>
	<table style = "margin-left:auto;margin-right:auto;">
	  <tr>
	    <td>
	      Username:
	    </td>
	    <td>
	      <input type = "text" name = "username" id = "username"  value = "" maxlength = "255"/>
	    </td>
	  </tr>
	  <tr>
	    <td>
	      Password:
	    </td>
	    <td>
	      <input type = "password" name = "password" maxlength = "255" />
	    </td>
	  </tr>
	  <tr>
	    <td colspan = "2" style = "text-align:center;">
	      <input type = "submit" name = "login" value = "Login" class = "submit"/>
	    </td>
	  </tr>
	</table>
	</form>
      </div>


      <!-- Here are the script tags -->
      <script type = "text/javascript">
      </script>


      </div>
      <div id = "footer">
	&copy; 2007 Augustana Library, University of Alberta
      </div>
    </div>
    <div id = "background-right">
    </div>
  </body>
</html>
Any idea why this is happening?
Last edited by pickle on Fri Nov 02, 2007 2:11 pm, edited 1 time in total.
Real programmers don't comment their code. If it was hard to write, it should be hard to understand.
User avatar
Kieran Huggins
DevNet Master
Posts: 3635
Joined: Wed Dec 06, 2006 4:14 pm
Location: Toronto, Canada
Contact:

Post by Kieran Huggins »

<script> MUST have a closing </script>

Everything up until your closing </script> is being included in the first open <script> section.

I know it seems dumb, I feel your pain.
User avatar
pickle
Briney Mod
Posts: 6445
Joined: Mon Jan 19, 2004 6:11 pm
Location: 53.01N x 112.48W
Contact:

Post by pickle »

Well then why the heck does it validate? Grrr. Thanks for the fix.
Real programmers don't comment their code. If it was hard to write, it should be hard to understand.
Post Reply