Posted on August 27, 2008 17:34 by baugustine
 

Interesting issue Shawn and I ran into today with the <script> tag in ASP .Net. A page was defined with <script> tag that was closed with a /> instead of </script> as shown below.

 

<script language="javascript" src="myJavaScripts.js" type="text/javascript" />

 

And any time a control on the page did a post back it started throwing java script errors such as "Object Expected". Other variants could be "__doPostback not defined" but I did not see that error. Anyway the culprit was the /> closing tag. So to fix the error I had to end the <script> tag with </script> tag instead of />. So changing the above statement to

 

<script language="javascript" src="myJavaScripts.js" type="text/javascript"><script>

 

fixed the error.

 

Incidentally this worked also.

 

<script language="javascript" src="myJavaScripts.js" type="text/javascript" />

<script></script>

 

Go figure.



Digg It!DZone It!StumbleUponTechnoratiRedditDel.icio.usNewsVineFurlBlinkList

Be the first to rate this post

  • Currently 0/5 Stars.
  • 1
  • 2
  • 3
  • 4
  • 5

Related posts

Comments

August 27. 2008 19:49

yes, W3C defines script as a closed tag, not self-closing as one would think with XHTML. Same applies for iframe as well...
|

timheuer

Add comment


 

[b][/b] - [i][/i] - [u][/u]- [quote][/quote]



Live preview

November 20. 2008 20:47

|