HI all,
I tried to read an array from an external javascript file called read.js,The array was declared & as well as defined with some values inside the <script> tag of a html file.
For an instance:
test.html:
--------------
<html>
<head>
<script>
var a=new Array(1,2,3);
</script>
<script type="text/javascript" src="read.js"></script>
</head>
</html>
read.js:
----------
a.sort();
alert(a[0]);
test.jsp:
--------------
<html>
<head>
<script>
var a=new Array(1,2,3);
</script>
<script type="text/javascript" src="read.js"></script>
</head>
</html>
This was successful.
But i am getting "undefined " as result when i tried test.html as test.jsp.
I am getting "undefined" message only when i tend to create array
"var a=new Array(1,2,3)" inside the <script>tag of test.jsp,But i did nt get any "undefined" message if i try the same thing with test.html.
I am getting problem while running this code at server side.
can u people guide me in resolving this problem???
Thanks in advance,
sundar
I tried to read an array from an external javascript file called read.js,The array was declared & as well as defined with some values inside the <script> tag of a html file.
For an instance:
test.html:
--------------
<html>
<head>
<script>
var a=new Array(1,2,3);
</script>
<script type="text/javascript" src="read.js"></script>
</head>
</html>
read.js:
----------
a.sort();
alert(a[0]);
test.jsp:
--------------
<html>
<head>
<script>
var a=new Array(1,2,3);
</script>
<script type="text/javascript" src="read.js"></script>
</head>
</html>
This was successful.
But i am getting "undefined " as result when i tried test.html as test.jsp.
I am getting "undefined" message only when i tend to create array
"var a=new Array(1,2,3)" inside the <script>tag of test.jsp,But i did nt get any "undefined" message if i try the same thing with test.html.
I am getting problem while running this code at server side.
can u people guide me in resolving this problem???
Thanks in advance,
sundar
Comment