473,405 Members | 2,310 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,405 software developers and data experts.

how does this script work?

How does the following javascript work? After the first script runs the
variables "sGeobytesCity", "sGeobytesRegion" and "sGeobytesCountry"
contain values that have been set somehow by the
"src=http://gd.geobytes.com..."

how does it do that? It appears to pass the string
"variables=GeobytesCountry, ..." and on return the document variable
"sGeobytesCountry" contains a value!!

thanks,

-Steve

------------------------------------------------

<html>
<body>
<script language="Javascript"
src="http://gd.geobytes.com/Gd?after=-1&variables=GeobytesCountry,GeobytesCity,GeobytesR egion">
</script>

<script language="javascript">
if(typeof(sGeobytesCountry) != "undefined" &&
typeof(sGeobytesRegion) != "undefined" &&
typeof(sGeobytesCity) != "undefined")
{
var url = 'CookieDemo.aspx?IPCity=' +
sGeobytesCity + '&IPRegion=' + sGeobytesRegion +
'&IPCountry=' + sGeobytesCountry ;
document.write("<META HTTP-EQUIV='Refresh' CONTENT='0; URL="+url+"'>");
}
else
{
document.write( "<META HTTP-EQUIV='Refresh' CONTENT='0;
URL=CookieDemo.aspx'>" ) ;
}
</script>

</body>
</html>

Jul 23 '05 #1
3 1835
On 27/05/2005 23:49, Steve Richter wrote:
How does the following javascript work? After the first script runs the
variables "sGeobytesCity", "sGeobytesRegion" and "sGeobytesCountry"
contain values that have been set somehow by the
"src=http://gd.geobytes.com..."


This has nothing to do with Javascript. The Gd resource will be a
server-side script written in PHP, ASP, or whatever, that outputs a
series of var statements. Which variables are written is determined by
the names listed in the query string. Nothing special - just like a
dynamically generated HTML document, only a script instead.

[snip]

Mike

--
Michael Winter
Replace ".invalid" with ".uk" to reply by e-mail.
Jul 23 '05 #2


Michael Winter wrote:
On 27/05/2005 23:49, Steve Richter wrote:
How does the following javascript work? After the first script runs the
variables "sGeobytesCity", "sGeobytesRegion" and "sGeobytesCountry"
contain values that have been set somehow by the
"src=http://gd.geobytes.com..."


This has nothing to do with Javascript. The Gd resource will be a
server-side script written in PHP, ASP, or whatever, that outputs a
series of var statements. Which variables are written is determined by
the names listed in the query string. Nothing special - just like a
dynamically generated HTML document, only a script instead.


Wow! When do I finally know everything there is to know about web
programming?

thanks for the explanation, Mike. The Src= causes javascript to be
returned from the URL, and that script contains a series of "var =
xxx;" statements. Those vars are then available to other scripts in
the document.

Who invented all this stuff??

-Steve

Jul 23 '05 #3
Steve Richter wrote:
Wow! When do I finally know everything there is to know about web
programming?
Perhaps never.
[...]
Who invented all this stuff??


Tim Berners-Lee started the Web by inventing HTML.
PointedEars
Jul 23 '05 #4

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

Similar topics

4
by: Brian Glen Palicia | last post by:
My goal is to accept input from the user into a text box and then parse the data using split(). The first step is this tiny program to test the split() function. It runs in IE, but in Mozilla it...
3
by: paul | last post by:
HI! I have being to add the following as part of a function but it just will not work as is but I don't know why, can someone point out why. This opens up a popup window for a popup detection...
4
by: E | last post by:
I am having trouble with setTimeout working on a second call to the setTimeout function from a second page which is an html page. Here is the scenario. I have a web page and onload it calls a...
17
by: StevePBurgess | last post by:
A really simple script is driving me up the wall. I have a very simply facility on a website to allow the user to reorder items in a database table as she wishes by clicking a link that (in this...
9
by: Stan B | last post by:
I create a popup window by calling window.showModalDialog Popup window has Ok button with this code attached: === string Script = "<script language=JavaScript>" + "{" + "window.close();" +...
25
by: Peter Michaux | last post by:
Hi, I'm thinking about code minimization. I can think of a few places where whitespace matters a + ++b a++ + b a - --b a-- -b when a line ends without a semi-colon in which case the new...
14
by: webEater | last post by:
I have a problem, it's not browser specific, and I don't get a solution. I have an (X)HTML document, I show you a part of it: .... <!--<div class="pad">--> <div id="eventImages"><img src=""...
5
by: =?Utf-8?B?SmltIFJvZGdlcnM=?= | last post by:
My question is simple: How does one debug ASP Classic with Microsoft Visual Web Developer Express 2005 ("VWD")? Looming in the back of anyone's mind when you see a posting like this on any...
2
chunk1978
by: chunk1978 | last post by:
i wrote a custom PHP script last year and everything worked perfectly... recently my webserver upgraded to PHP 5 and now my script doesn't work properly. what the script does is: users fill out...
5
by: Pat | last post by:
Hi ASP Gurus, Please help me. Autocomplete works fine when the control does not have the focus when the page load. But when I put the focus on page load, then autocomplete does not work. I even...
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?
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
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
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...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

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.