View Full Version : Script and html validation

Big Fat
Jul 31st, 2004, 04:39 AM
When trying to validate this page in html 4.01 strict, I get errors for the java script. Any ideas why? The css and the html does validate.


here's the code:


<SCRIPT Language="Javascript">var xPos = (screen.width/2)-(450/2);
var yPos = (screen.height/2)-(450/2);
var pWin = null;

//open pop wait screen
function showPop1(sLoc) {
pWin = window.open(sLoc,"pWin", "height=2,width=2,status=0,menubar=0,location=0,resizable=1,titlebar=0,scrollbars=1,top=0,left=0");
pWin.resizeTo (450, 450);
pWin.moveTo (xPos, yPos);


<script>// message to show in non-IE browsers
var txt = "[Bookmark Mortgage Manager Page]"
var url = "http://www.mybigfatmortgage.net/signup.html";
var who = "Mortgage Manager Biweekly Mortgage"

// ===========================
var ver = navigator.appName
var num = parseInt(navigator.appVersion)
if ((ver == "Microsoft Internet Explorer")&&(num >= 4)) {
document.write('<A HREF="javascript:window.external.AddFavorite(url,who);" ');
document.write('onMouseOver=" window.status=')
document.write("txt; return true ")
document.write('"onMouseOut=" window.status=')
document.write("' '; return true ")
document.write('">'+ txt + '</a>')
txt += " (Ctrl+D)"
} </script>

Willy Duitt
Jul 31st, 2004, 10:46 AM
What do the errors say....
Where are they pointing to? Is there a line?
For one, language was deprecated 5 years ago....


Big Fat
Jul 31st, 2004, 04:47 PM
I don't know anything about javascript. These were cut and paste off the net. I change the code to <script type="text/javascript"> and that fix two errors and the code still works. Here is the error I'm getting -

Line 94, column 34: end tag for element "A" which is not open

document.write('">'+ txt + '</a>')

The Validator found an end tag for the above element, but that element is not currently open

Big Fat
Jul 31st, 2004, 05:26 PM
I found one that validates. I also found that putting this script on a page is insulting because it indicates people don't know how to use their browsers. I don't agree - it makes the process of bookmarking faster. Comments?

Willy Duitt
Jul 31st, 2004, 05:52 PM
Yea you will have to split that closing anchor tag so it is not parsed together....

Try this: document.write('">'+ txt + '<'+'/a>')

BTW: I'm sure some users would appreciate the bookmark here link and would not find it insulting let alone realize that its appearence is or would be insulting to others. Heck, you would not believe how many users can mess up a simple form submission which has a couple of required, common sense fields....

Big Fat
Aug 1st, 2004, 03:49 AM
My page now validates. I agree and left the book mark in. Thanks for the help.