By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
455,775 Members | 1,325 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 455,775 IT Pros & Developers. It's quick & easy.

vars and javascript

P: n/a
I try to do the following:

<script>
<!--

function getStats() {

nav = navigator.appName;
c = 0;
if (nav != "Netscape") {
c = screen.colorDepth;
} else {
c = screen.pixelDepth;
}

s = screen.width+" X "+screen.height;
ref = escape(document.referrer);
url = escape(document.URL);

var stats = "referrer=" + ref + "&get_url=" + url + "&screen=" + s +
"&color=" + c;
return stats;
}
//-->
</script>

<script language="JavaScript"
src="http://www.yourserver.com/counter.php?klant_id=62&' + stats
+'"></script>

But the stats var is not put through to the second script ...
Is there another way to achieve this?

Kind regards,

Dom.
--
--
Trinch | New Media Services

Dominique Vermeersch
Tiengebodenstraat 21
8740 Pittem (Belgium)

Gsm. +32 (0) 478 958 853
do*******@trinch.com
http://www.trinch.com
Jul 23 '05 #1
Share this Question
Share on Google+
2 Replies


P: n/a
Dominique Vermeersch wrote on 21 mrt 2005 in comp.lang.javascript:
I try to do the following:

<script>
<script type='text/javascript'>
<!--
Outdated for the last 5 years

function getStats() {

nav = navigator.appName;
c = 0;
not usefull since it will be reassigned anyway
if (nav != "Netscape") {
c = screen.colorDepth;
} else {
c = screen.pixelDepth;
}

s = screen.width+" X "+screen.height;
ref = escape(document.referrer);
url = escape(document.URL);

var stats = "referrer=" + ref + "&get_url=" + url + "&screen=" + s +
"&color=" + c;
return stats;
}
//-->
same
</script>

<script language="JavaScript"
outdated, use:

type='text/javascript'
src="http://www.yourserver.com/counter.php?klant_id=62&' + stats
This does not work.
There is no reason for javascript to be executed in a src declaration.
Echt niet!
+'"></script>

But the stats var is not put through to the second script ...
Is there another way to achieve this?


Natuurlijk, gebruik serverside code, blijkbaar gebruik je php, waar ik
niets van weet, maar in ASP is het makkelijk.

Reload the whole page after posting the stats to serverside.

--
Evertjan.
The Netherlands.
(Replace all crosses with dots in my emailaddress)

Jul 23 '05 #2

P: n/a
Declare the var outside of a function, then you can use it in any function
on the page.
Jul 23 '05 #3

This discussion thread is closed

Replies have been disabled for this discussion.