hello all,
please forgive me if this is stupid question as my knowledge of programming is limited and thanks in advance for the answers.
i have an external javascript file test.js and it has
test.js
-------------------------
- var x = null;
-
var y = null;
-
function goSubmit()
-
{
-
x = document.getElementById("machine").value;
-
alert(x+"inside");
-
}
-
-
function calling()
-
{
-
y = x;
-
alert(y+"outside");
-
....somecode
-
}
and i have html page test.html with following code
[HTML]<html>
<head>
<script language="javascript" src="test.js"></script>
</head>
<body>
<i><input type="text" onclick="this.value = ''" id="machine" value="Enter Node Name!" size="36" name="machine"></i>
<a onclick="javascript
:goSubmit()" href="other.html" target="_self">Connect</a>
</body>
</html>[/HTML]
and the result i get when i input the name "system1" i got the following reults
system1 inside
null outside.
so the question is there any work around possible to assign value to global variable so that they can be used later on in the script. some coding example (if possible making the above script complete) will be highly appreciated.