lilman Posted December 30, 2006 Share Posted December 30, 2006 I wrote this script and I don't see what is wrong with it. Here is the code<html><head><title><script type="text/javascript">function displayText(){ document.write("You're using JavaScript");}</script></title></head><body onMouseDown="displayText()"><h1> <br /><input name="color" type="button" onclick="document.bgcolor='pink'"></h1></body></html>and here is the error I get when I run it:Line: 12Char: 1Error: Object exceptedCode: 0 Quote Link to comment Share on other sites More sharing options...
michaellunsford Posted December 30, 2006 Share Posted December 30, 2006 maybe you shouldn't be putting a <script> tag inside your <title> tag?[quote author=http://validator.w3.org]Error Line 4 column 30: document type does not allow element "SCRIPT" here.[/quote] Quote Link to comment Share on other sites More sharing options...
lilman Posted December 30, 2006 Author Share Posted December 30, 2006 thanks, boy do I feel silly. there is this code, now it doesn't produce an error notification but it doesn't change the bgcolor. <input name="color" type="button" onMouseDown="document.bgcolor='pink'">is there something wrong there? Quote Link to comment Share on other sites More sharing options...
michaellunsford Posted December 30, 2006 Share Posted December 30, 2006 a few possibilities. 1. "onmousedown" is supposed to be all lowercase.2. document.bgColor is NOT supposed to be all lowercase.3. onMouseDown -- isn't that flash? I'd use onclick.[code]onclick="document.bgColor='pink';"[/code] Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.