The Artima Developer Community
Sponsored Link

Java Answers Forum
plz.......javascript question

5 replies on 1 page. Most recent reply: Aug 15, 2003 6:00 AM by David

Welcome Guest
  Sign In

Go back to the topic listing  Back to Topic List Click to reply to this topic  Reply to this Topic Click to search messages in this forum  Search Forum Click for a threaded view of the topic  Threaded View   
Previous Topic   Next Topic
Flat View: This topic has 5 replies on 1 page
Sarah

Posts: 4
Nickname: sarah
Registered: Jul, 2003

plz.......javascript question Posted: Aug 13, 2003 12:01 AM
Reply to this message Reply
Advertisement
Hi
plz I want to ask your help,My Question is
how can i define global variable using javascript, i want variable that i can
define it in one page and assign value to it and then can use it in other pages and can
change its value in other pages
thank you


David

Posts: 150
Nickname: archangel
Registered: Jul, 2003

Re: plz.......javascript question Posted: Aug 13, 2003 1:55 AM
Reply to this message Reply
This is a Java forum, not JavaScript. The two things are completely different. You're in good company - a lot of people think they're one and the same.

However, with regards to your question, I don't *think* that it is easily done in JavaScript (it wouldn't be a problem in JSP or PHP).

I suggest posting on a JavaScript forum where there are people who really know this sort of stuff.

Matt Pociask

Posts: 9
Nickname: mpociask
Registered: Aug, 2003

Re: plz.......javascript question Posted: Aug 14, 2003 1:43 PM
Reply to this message Reply
Simple. Just put the variable in an external .js file. Then to link that file into the HTML, use <script src="SCRIPTNAME.js"></script>.

Java and JavaScript have similar syntax but are very different. Java was developed by Sun Microsystems and JavaScript by Netscape. I think the reason they chose JavaScript, instead of something like NetscapeScript (besides the syntactical similarities) is that JavaScript was designed to run on any platform, unlike VBScript which only runs on IE.

Hope this helps!

Syed

Posts: 2
Nickname: j2eesdkal
Registered: Aug, 2003

Re: plz.......javascript question Posted: Aug 14, 2003 11:04 PM
Reply to this message Reply
This is possible in a case where windows have parent child relationship. Say Win1 is parent and Win2 is child, where Win2 is opened from Win1 using window.open().
U can declare global variables between ur script tags in Win1. For example
<Script>
var Var1 = -1;
var Var2 = -2;

function Func1()
{
}
</Script>
Now in ur child window Win2 u can access Var1 and Var2 from Win1 as
opener.Var1 = 0;
opener.Var2 = 0;

Sarah

Posts: 4
Nickname: sarah
Registered: Jul, 2003

Re: plz.......javascript question Posted: Aug 15, 2003 3:31 AM
Reply to this message Reply
Thank you very much for ur help i will try now
bye

David

Posts: 150
Nickname: archangel
Registered: Jul, 2003

Re: plz.......javascript question Posted: Aug 15, 2003 6:00 AM
Reply to this message Reply
"Java and JavaScript have similar syntax but are very different. Java was developed by Sun Microsystems and JavaScript by Netscape. I think the reason they chose JavaScript, instead of something like NetscapeScript (besides the syntactical similarities) is that JavaScript was designed to run on any platform"

I doubt it:

http://www.oreillynet.com/pub/a/javascript/2001/04/06/js_history.html

(and also an attempt to cash in on Java's hype).

FYI - the formal language is actually called ECMA Script.

Flat View: This topic has 5 replies on 1 page
Topic: What version are the JNI header files suppose to work with? Previous Topic   Next Topic Topic: java linklist debug error

Sponsored Links



Google
  Web Artima.com   

Copyright © 1996-2019 Artima, Inc. All Rights Reserved. - Privacy Policy - Terms of Use