Hi guys,
Anyone know how I can get
<script type="text/javascript" language="JavaScript"> <!-- Begin if ((navigator.appName == "Microsoft Internet Explorer") && (parseInt(navigator.appVersion) >= 4)) { var url="http://www.fsus.fsu.edu/FSUSNew"; var title="Florida State Univerity Schools"; document.write('<A HREF="javascript:window.ext'); document.write('ernal.AddFavorite(url,title);" '); document.write('class="bottom" onMouseOver=" window.status='); document.write("'Bookmark our website!'; return true "); document.write('"onMouseOut=" window.status='); document.write("' '; return true "); document.write('">Bookmark Us!</a>'); } else { var msg = "Bookmark Us!"; if(navigator.appName == "Netscape") msg += " (CTRL-D)"; document.write(msg); } // End --> </SCRIPT>
To validate in HTML 4.01 Transitional? I get end tag for element "A" which is not open error.
Thank you
Valid HTML 4.01 Transitional Bookmark Code
I know very little about javascript but from general coding knowledge I can see that you are using capital letters for your tags and properties where they should be lowercase (e.g. A, HREF, onMouseOut etc.), although I thought that was acceptable for HTML, and you seem to be mixing up your single and double quotes in the wrong way. Study the code that is generated by your script, particularly the quotes, and all should become clear.
Valid HTML 4.01 Transitional Bookmark Code
Hi thatsgame1,
It's probably a good idea to use lower case for the start and end of the tag.
I'm not sure if that's your error I thought case wasn't important till XHTML.
Valid HTML 4.01 Transitional Bookmark Code
thatsgame1,
I've reworked the code for you and it now validates. In the future, you really should avoid using uppercase for tags. It makes us standards people shiver in horror. Also, I like to create functions for little jobs when I can. It will keep your code a lot cleaner and easier to update in the future.
The main reason your code didn't validate under the 4.01 doctype is because you need backslash your forward slashes whenever you are within <script></script>
Your closing <a></a> tag had to look like this to work:
<\/a>
Here's the reworked code:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"> <html> <head> <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1"> <title></title> <script type="text/javascript"> // globals var url="http://www.fsus.fsu.edu/FSUSNew"; var title="Florida State Univerity Schools"; // functions function addFav() { window.external.AddFavorite(url,title); } function setStatus(statText) { window.status=statText; } if ((navigator.appName == "Microsoft Internet Explorer") && (parseInt(navigator.appVersion) >= 4)) { document.write('<a href="#" onclick="addFav()" class="bottom"'); document.write('onmouseover="setStatus(\'Bookmark our website\'); return true"'); document.write('onmouseout="setStatus(\'\'); return true">'); document.write('Bookmark Us!'); document.write('<\/a>'); } else { var msg = "Bookmark Us!"; if(navigator.appName == "Netscape") msg += " (CTRL-D)"; document.write(msg); } </script> </head> <body> </body> </html>
Valid HTML 4.01 Transitional Bookmark Code
Hello antibland
Thank you for taking the time to help me. I really appreciate it and thanks for the advice.
Thanks again,
Andrew