Tycoon Talk
Become a Big fish!
The number 1 forum for online business!
Post topics, ask questions, share your knowledge.
Tycoon Talk is part of Freelancer.com - find skilled workers online at a fraction of the cost.

JavaScript Forum


You are currently viewing our JavaScript Forum as a guest. Please register to participate.
Login



Reply
Script stopped working
Old 07-19-2008, 08:36 PM Script stopped working
Average Talker

Posts: 25
Name: John Grafflin
Trades: 0
I updated an old script and now it doesn't work. I can't remember all the changes. Perhaps someone can spot the error(s)?

Code:
<script type="text/javascript">jsver = "1.0";</script>
<script type="text/javascript1.1">jsver = "1.1";</script>
<script type="text/javascript1.2">jsver = "1.2";</script>
<script type="text/javascript1.3">jsver = "1.3";</script>
<script type="text/javascript1.4">jsver = "1.4";</script>
<script type="text/javascript1.5">jsver = "1.5";</script>
<script type="text/javascript1.6">jsver = "1.6";</script>
<script type="text/javascript1.7">jsver = "1.7";</script>
<script type="text/javascript1.8">jsver = "1.8";</script>
<script type="text/javascript1.9">jsver = "1.9";</script>
<script type="text/javascript2.0">jsver = "2.0";</script>
<script type="text/javascript">
<!--
data = "agent=" + escape(navigator.userAgent)+ "&appname=" + escape(navigator.appName)+
"&os=" + escape(navigator.platform)+ "&appversion=" + escape(navigator.appVersion)+ "&referrer=" + escape(document.referrer)+
"&site=4" + "&jsver=" + escape(jsver);if(navigator.language) {data = data + "&language=" + escape(navigator.language); } 
else if(navigator.browserLanguage) {data = data + "&language=" + escape(navigator.browserLanguage); } 
else {data = data + "&language=" + escape(navigator.userLanguage); } 
if((navigator.appVersion).substring(0,1)>'3') { data = data + "&extra=1&colordepth=" + escape(screen.colorDepth)+
"&screenwidth=" + escape(screen.width)+ "&screenheight=" + escape(screen.height)+ "&javaenabled=" +
escape(navigator.javaEnabled()); } document.write("<a href=http://www.webstatsdepot.com/totalVisitors.php?site=4>
<img src=http://www.webstatsdepot.com/logger.php?"+data+" width=0; height=0; border=0></a>");
//-->
</script>

Last edited by jwgrafflin; 07-20-2008 at 08:47 AM.. Reason: removed formatting
jwgrafflin is offline
Reply With Quote
View Public Profile
 
 
Register now for full access!
Old 07-19-2008, 10:53 PM Re: Script stopped working
wayfarer07's Avatar
Poo on You

Latest Blog Post:
Introducing WowWindow
Posts: 3,985
Name: Abel Mohler
Location: Asheville, North Carolina USA
Trades: 0
The only error I found was that there needs to be a space between the "else" and the "if" on the line:
Code:
elseif(navigator.browserLanguage
The script didn't do anything apparent on my computer (the image it generated had 0 height and 0 width), but I saw the document change when I loaded it in Firebug.

P.S. What an ugly piece of code. What on earth is it for? Too glaring, I'm afraid, for me to want to examine it closely.

__________________
Join me on
Please login or register to view this content. Registration is FREE

Last edited by wayfarer07; 07-19-2008 at 10:58 PM..
wayfarer07 is offline
Reply With Quote
View Public Profile Visit wayfarer07's homepage!
 
Old 07-20-2008, 03:21 AM Re: Script stopped working
chrishirst's Avatar
Missing! presumed drunk.

Posts: 41,517
Name: Chris Hirst
Location: Blackpool. UK
Trades: 0
It's browser version, display resolution & colour depth detection for a old visitor tracking system.
The script calls a remote image and passes the details in a GET to a remote site and it pre-dates the introduction of the xmlHTTP object.
__________________
Chris. ->> Links are advertising NOT optimising!! <<-
A foolish consistency is the hobgoblin of little minds
Thought for today:- I SEO the only industry where all the cowboys are Indians?
chrishirst is offline
Reply With Quote
View Public Profile Visit chrishirst's homepage!
 
Old 07-20-2008, 09:09 AM Re: Script stopped working
Average Talker

Posts: 25
Name: John Grafflin
Trades: 0
As I said, it's an old script I'm trying to update. I edited the language detection portion (previously it only detected navigator.userLanguage) and then re-arranged the order to make it easier to read (for me anyway) and edit.

Keep in mind, this is just the data collection script. The image part is there as an option, if it is selected in the program config (and the "else if" does have the space).

Just trying to take it step by step to get to a more "modern" form, unless someone has a better idea.
jwgrafflin is offline
Reply With Quote
View Public Profile
 
Old 07-20-2008, 09:41 AM Re: Script stopped working
chrishirst's Avatar
Missing! presumed drunk.

Posts: 41,517
Name: Chris Hirst
Location: Blackpool. UK
Trades: 0
Convert it into a xmlHTTP version (ala Google Analytics) would make sense.


and BTW you need to define
Quote:
now it doesn't work
for us
__________________
Chris. ->> Links are advertising NOT optimising!! <<-
A foolish consistency is the hobgoblin of little minds
Thought for today:- I SEO the only industry where all the cowboys are Indians?
chrishirst is offline
Reply With Quote
View Public Profile Visit chrishirst's homepage!
 
Old 07-27-2008, 08:54 PM Re: Script stopped working
Average Talker

Posts: 25
Name: John Grafflin
Trades: 0
The logger file works, but the javascript is not passing the information to that file. In other words, document.write is not calling the logger file as it should. I understand xmlHTTP object should do the trick, but have no idea how to implement.
jwgrafflin is offline
Reply With Quote
View Public Profile
 
Old 07-27-2008, 09:44 PM Re: Script stopped working
Super Talker

Posts: 116
Trades: 0
do a quick google on AJAX and XMLHttpRequest and you'll find loads of tutorials on how to use/implement it. its relatively straightforward.

actually, i'm working on a firefox addon that uses it and i had this reference tab open: http://developer.mozilla.org/en/docs/XMLHttpRequest

sure, its for firefox addon deving, but its still javascript. similar.
__________________


Please login or register to view this content. Registration is FREE

nasaboy007 is offline
Reply With Quote
View Public Profile Visit nasaboy007's homepage!
 
Old 07-27-2008, 11:17 PM Re: Script stopped working
Average Talker

Posts: 25
Name: John Grafflin
Trades: 0
After viewing several of those pages, it seems to me I'll need about thirteen pages of code to replace "document.write." Isn't there some place where they talk in English, instead of geekeese?

Last edited by jwgrafflin; 07-27-2008 at 11:19 PM..
jwgrafflin is offline
Reply With Quote
View Public Profile
 
Old 07-28-2008, 01:14 AM Re: Script stopped working
Average Talker

Posts: 25
Name: John Grafflin
Trades: 0
Problem solved.

The answer was right there in front of me the whole time, I just didn't see it.

My HTML editor program color codes specific parts of the code to indicate proper format. In this particular case, all the ";" at the end of code lines was colored green, except for the very last one, like this:

Code:
document.write("<a href='http://www.webstatsdepot.com/totalVisitors.php?site=4'>
<img src='http://www.webstatsdepot.com/logger.php?"+data+"' width=0 height=0 border=0></a>");
So, I made a slight modification, and now the code works.

Code:
document.write("<a href='http://www.webstatsdepot.com/totalVisitors.php?site=4'><img src='http://www.webstatsdepot.com/logger.php?"+data+"' width=0 height=0 border=0></a>");
Tested it in IE7, FireFox 2.0 and Opera 9.5, all with the desired results, and using Doctype XHTML 1.0 Strict, plus the page validates at W3C.
jwgrafflin is offline
Reply With Quote
View Public Profile
 
Reply     « Reply to Script stopped working
 

Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are Off
Pingbacks are Off
Refbacks are Off





   
RSS Feed  Feeds: RSS   JS   XML
RSS Feed  Feeds for this forum: RSS   JS   XML



Page generated in 0.52581 seconds with 12 queries