Computing.Net > Forums > Programming > JavaScript Help

Computer Problems? Computing.Net has over 1,000,000 posts about all things technology related! Over 90% answered within 24 hours! Click here to start participating now! Also, be sure to check out the New User Guide.

JavaScript Help

Reply to Message Icon

Name: TheMASTER69
Date: February 7, 2009 at 18:00:44 Pacific
OS: Windows XP
CPU/Ram: Intel 1.4ghz; 504mb
Product: Dell / Insperion
Subcategory: Java
Comment:

I have absolutly no Javascript coding knowledge but i think what i need to do is relitivly easy...

I have a webpage with a javascript variable that is
var RACE_PROPERTIES =

That variable needs to change according to another page on a different server

so is there a way i can set var RACE_PROPERTIES on my page to equal var SETTING on site2.com/testing

i think this is possible with get variable but i dont know javascript so any help will be greatly appriciated.



Sponsored Link
Ads by Google

Response Number 1
Name: uptoeleven
Date: February 9, 2009 at 16:47:41 Pacific
Reply:

This is one of those tasks that you believe will be easy until you think carefully about it:

Here's what I mean.

Let's imagine we are on the other server. We have a document in which there is some javacsript and in that javascript is a variable, with a value. The javascript itself is just a bunch of words and letters and punctuation. It's nonsense until it's seen by a browser which can interpret the words and letters and punctuation.

So back on your server, what you need to do is make your javascript program open a new browser, run the page, interrogate the page and return the value that's held in that particular javascript variable. The problem you have is that the value of that javascript variable is not accessible through the document object model (DOM) which is what you would normally use.

If you have control over site2.com/testing then you could get it to write the value of that variable into an object (a div with an id) on the page which you could then easily interrogate. My guess is that you don't have access to site2.com/testing or you wouldn't be trying to do this.

So the answer is, because you need a javascript interpreter to interpret javascript, and because these are built into the machine code of the browser and are not accessible from within the browser, it probably is not possible to do what you are trying to do, in the way you are trying to do it. There are, however, other ways to achieve a similar effect.


0

Response Number 2
Name: TheMASTER69
Date: February 17, 2009 at 17:08:57 Pacific
Reply:

Well I have to thank you Uptoeleven you made it very clear for me. Its to bad its difficult to do so but I guess thats life.


0

Sponsored Link
Ads by Google
Reply to Message Icon

Related Posts

See More







Post Locked

This post is quite old and has been locked from receiving new replies. Please create a new posting instead.


Go to Programming Forum Home


Sponsored links

Ads by Google


Results for: JavaScript Help

Javascript help www.computing.net/answers/programming/javascript-help/9864.html

Javascript help www.computing.net/answers/programming/javascript-help/8230.html

Javascript Help www.computing.net/answers/programming/javascript-help/3967.html