473,387 Members | 1,545 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,387 software developers and data experts.

vars and javascript

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
2 1526
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
Declare the var outside of a function, then you can use it in any function
on the page.
Jul 23 '05 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

12
by: mbasil7 | last post by:
Hi at all! I want to use a javascript variable in php. The reason is that i want to know the client's screen resolution. Here is the code i'm using: <head> <script language='JavaScript'>...
1
by: optimistx | last post by:
How to build or find an object browser for javascript? E.g. Delphi integrated developement environment ('ide') offers a very practical object browser for Pascal language. When typing a name with...
5
by: Jim Banks | last post by:
Greetings I'm opening a pop up window with a html form, (in one document) and I want to pass a variable to the html form called from the hyperlink. Here's the code I'm using to pop up the...
7
by: Jean Pion | last post by:
Dear readers, Is there somewhere, maybe $_SESSION vars?, where my PHP knows that JavaScript is enabled on the clients webbrowser. I uses some JavaScript but would like to add workaround in case...
1
by: news.wanadoo.nl | last post by:
Hi, I have found whit google this form in this group. But i'n not good in javascript :(. I try and error normal but i only error now :P Whit i now want to now how can i get access to the vars...
1
by: radiox | last post by:
Hi guys, I have this html file containing: <html><head> <script src="variable.js?id=1004"></script> </head><body></body></html> I also have the .js file that looks like this...
1
by: M | last post by:
On our site we have contentitems which suppose to be embedded in a productsheet. My idea is to check the URL to see if the item is opened the way it should. EG: the URL...
19
RMWChaos
by: RMWChaos | last post by:
Previously, I had used independent JSON lists in my code, where the lists were part of separate scripts. Because this method did not support reuse of a script without modification, I decided to...
2
by: I Hate My Computer | last post by:
I am using frames on a website. The title link on the title page adds a query string. The link goes to a page with two rows the second has two columns. I want the right column to be changed depending...
4
by: MartinRinehart | last post by:
I've written a short article explaining closures in JavaScript. It's at: http://www.martinrinehart.com/articles/javascript-closures.html I think I've understood. I look forward to your...
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.