...

View Full Version : Multiple Javascripts ("Done, but with errors on page")



Dan6971
12-18-2003, 06:48 PM
I just added a new javascript to my page:

http://www.pianomanfan.com/footer.ssi

I am getting the "Done, but with errors on page" in my status bar. Could this be from having multiple javascripts on the page?

Please help...


Thanks!
Dan

A1ien51
12-18-2003, 07:06 PM
the error says it is around line 130


that is where you have some bookmark - status thing script

Dan6971
12-18-2003, 07:09 PM
Yes, it is a new bookmarking script that bookmarks the actual page. Can you help fix the following code - thanks!?!?!?!?!?!

<script language="JavaScript">

<!--

// message to show in non-IE browsers
var txt = "Bookmark This Page!!!"
// do not edit below this line
// ===========================

var url = this.location;
var who = document.title;
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('<a href="http://www.PianoManFan.com/Bookmark.html"><img name="Bookmark" src="http://www.PianoManFan.com/BookmarkButton.gif" width="158" height="37" border="0" alt=""></a>')
}else{
txt += " (Ctrl+D)"
document.write(txt)
}

//-->
</script>


THANKS!
Dan

adios
12-18-2003, 07:41 PM
The bookmarking script seems fine. Mozilla is giving me a error on the following (age calculation) script. You've got this:


countup(2003,05,09)
...and the leading zeroes on the date & month numbers are causing them to be interpreted as octal (base-eight) numbers. Try it without the '0'.

Dan6971
12-18-2003, 08:57 PM
I still got errors...

RoyW
12-18-2003, 10:35 PM
There is nothing wrong with the javascript as such.
What is happening is you are writing garbage HTML into the document. The HTML has invalid onMouseOver/Out JavaScript code that is terminated incorrectly.

Your javascript is correct, the code it generates is causing the JavaScript Error.

Take a look at what you are trying to write out.



<A HREF="javascript:window.external.AddFavorite(url,who);" onMouseOver=" window.status=txt; return true "onMouseOut=" window.status=' '; return true <a href="http://www.PianoManFan.com/Bookmark.html"><img name="Bookmark" src="http://www.PianoManFan.com/BookmarkButton.gif" width="158" height="37" border="0" alt=""></a>

Roy Sinclair
12-18-2003, 10:37 PM
Scrap the bookmarking script and link. It just wastes space on your page because anyone who finds your page compelling enough is going to bookmark it anyway. You're wasting your time and effort duplicating things that the browser window interface already provides.

Dan6971
12-18-2003, 11:08 PM
Roy, how can I fix it?

THANKS!

RoyW
12-19-2003, 12:09 AM
<!--
// message to show in non-IE browsers
var txt = "Bookmark This Page!!!"
// do not edit below this line
// ===========================
var url = this.location;
var who = document.title;
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('"><img name="Bookmark" src="http://www.PianoManFan.com/BookmarkButton.gif" width="158" height="37" border="0" alt=""></a>')
}else{
txt += " (Ctrl+D)"
document.write(txt)
}
//-->

Dan6971
12-19-2003, 12:20 AM
OK, the error went away, but when clicking the bookmark link, it did not allow me to add a favorite, rather, it linked to this page:

http://www.pianomanfan.com/java%20script:window.external.AddFavorite(url,who);

(I put the code back to what it was.)


THANKS!!!!!!!

RoyW
12-19-2003, 01:38 AM
document.write('<A HREF="javascript:window.external.AddFavorite(url,who);" ');

Should be all one word. No spaces. this forum splits it up. Make sure it is all one word. javascript

Dan6971
12-19-2003, 02:34 AM
That is exactly what I have...

RoyW
12-19-2003, 02:57 AM
Are you sure?.
When I tested it it worked fine. (I always test before I post any code.)

The URL you posted as the result of the script had a space in it.

I just cut and paste the script from this thread into a notepad document and when I tested it gave this result

http://www.pianomanfan.com/java%20script:window.external.AddFavorite

Which is what you say you got.

I then edited the code and made sure that the word javascript was all one word and it worked fine.


Can you set up a test page?

Dan6971
12-19-2003, 03:08 AM
BRILLIANT!!!

I did a spot check on about 10 pages, all were good, but this one:

http://www.pianomanfan.com/Albums.shtml

Any ideas?

RoyW
12-19-2003, 04:37 AM
Yes, I know what is wrong. Unfortunately I have just noticed I shouldn't be helping you at all.

Please see this (No 2 :( )
http://www.dynamicdrive.com/notice.htm

Fix this error on all your pages and I will help fix your page

Please respect the work of others.

Dan6971
12-19-2003, 05:22 AM
OK, other than my homepage, I have added the following to my pages, go check...:

/*
Submit Once form validation-
Dynamic Drive (www.dynamicdrive.com)
For full source code, usage terms, and 100's more DHTML scripts, visit http://dynamicdrive.com
*/


Dan

RoyW
12-19-2003, 04:16 PM
Hi,
Thanks for that. You use a lot of scripts. You should really use the original credits as not all the scripts are the "Submit Once form validation" script (in fact I don't think any are?

Most however do come from Dynamic Drive.

As for the page with errors. Apart from the fact you have 2 </head> tags and 3 <body> tags!!

There is an onload="show_clock()" but there is no show_clock() function in any of the javascripts on that page.

Dan6971
12-19-2003, 05:25 PM
OK, so I can take out those HEAD and BODY tags - however, that "Show Clock" thing refers to a script in my FOOTER - does that mean that I added it on my ALBUMS page by mistake and I can just remove it?



THANKS SOOOOO MUCH!!!
Dan

Dan6971
12-20-2003, 03:26 AM
Please help.

I have tags in my headers and footers - is that adding to the codes of my pages and messing them up?


Thanks,
Dan



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum