LifeInBinary Posted February 28, 2007 Share Posted February 28, 2007 Hey guys,How do you call a JavaScript document from an HTML document? Is it done the same way as with calling CSS?Thanks for the help,LifeInBinary. Link to comment Share on other sites More sharing options...
croatiankid Posted February 28, 2007 Share Posted February 28, 2007 <script type="text/javascript" src="link.js"></script> in html<script type="text/javascript" src="link.js" /> works in xhtml Link to comment Share on other sites More sharing options...
jesh Posted February 28, 2007 Share Posted February 28, 2007 <script type="text/javascript" src="link.js" /> works in xhtmlDoes it? I've never had any luck getting that to work. I've always had to use the end tag (</script>). Link to comment Share on other sites More sharing options...
vchris Posted February 28, 2007 Share Posted February 28, 2007 I'm using xhtml 1.0 strict and it does validate. Link to comment Share on other sites More sharing options...
LifeInBinary Posted February 28, 2007 Author Share Posted February 28, 2007 <script type="text/javascript" src="link.js"></script> in html<script type="text/javascript" src="link.js" /> works in xhtmlThanks croatiankid, that's exactly what I'm looking for.LifeInBinary. Link to comment Share on other sites More sharing options...
LifeInBinary Posted February 28, 2007 Author Share Posted February 28, 2007 I'm using xhtml 1.0 strict and it does validate.nice, thanks vchris.LifeInBinary. Link to comment Share on other sites More sharing options...
jesh Posted February 28, 2007 Share Posted February 28, 2007 I'm using xhtml 1.0 strict and it does validate.The HTML validates, but does the included script execute? Link to comment Share on other sites More sharing options...
LifeInBinary Posted February 28, 2007 Author Share Posted February 28, 2007 The HTML validates, but does the included script execute?That's a very important issue.Does the script run vchris?Thanks,LifeInBinary. Link to comment Share on other sites More sharing options...
croatiankid Posted February 28, 2007 Share Posted February 28, 2007 I don't know. Why don't you try it and see? Link to comment Share on other sites More sharing options...
jesh Posted February 28, 2007 Share Posted February 28, 2007 I don't know. Why don't you try it and see?Yeah, just like I remembered, this does not work in IE. You have to use:<script type="text/javascript" src="link.js"></script> Link to comment Share on other sites More sharing options...
croatiankid Posted March 1, 2007 Share Posted March 1, 2007 sigh. But I think (certain) auto-closed empty tags work in IE, like <div />. Link to comment Share on other sites More sharing options...
Skemcin Posted March 1, 2007 Share Posted March 1, 2007 <script type="text/javascript" src="link.js">Your browser settings have javascript disabled - you will not be able to xxxx xx xxx xxxx</script> Problem solved place this in the <head> tag of any HTML 4.01 Transitional, HTML 4.01 Strict, XHTML 1.0 Transitional, XHTML 1.0 Strict, XHTML 1.1 page and you are set.Make sure you validate your page before you put this in if you are going to check this for your self.There should be no reason why this doesn't work in FF, IE, NN, or Opera. I don't have time to check every example in every browser. But you guys have to remember to use the tag as it is defined to be used if you are going to worry about validation. Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now