Page 1 of 1

[solved] <script> tags stopping display

Posted: Fri Nov 02, 2007 12:59 pm
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?

Posted: Fri Nov 02, 2007 1:20 pm
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.

Posted: Fri Nov 02, 2007 2:08 pm
by pickle
Well then why the heck does it validate? Grrr. Thanks for the fix.