0

The sample code is given below,,

<body>

<script type="text/javascript">
var i=123;
alert("Value of i= "+i);
</script>

<!-- I need to access the variable "i" here.
     And store it in an integer variable.
 -->

</body>
Dijkgraaf
  • 11,049
  • 17
  • 42
  • 54
psd
  • 13
  • 4
  • 1
    So you need to access javascript outside script tags ? – adeneo Mar 25 '14 at 07:39
  • possible duplicate of [Reference: Why does the PHP (or other server side) code in my Javascript not work?](http://stackoverflow.com/questions/13840429/reference-why-does-the-php-or-other-server-side-code-in-my-javascript-not-wor) – Quentin Mar 25 '14 at 07:40
  • JSP or JavaScript? Seems you start to confuse things. – Raptor Mar 25 '14 at 07:41
  • It is a JSP page. Ineed to access the variable "i" in the commented region. – psd Mar 25 '14 at 07:46
  • Yes adeneo, I need to access the variable "i" outside the script tag. – psd Mar 25 '14 at 07:47
  • Can I store the value of "i" in session? – psd Mar 25 '14 at 08:57

1 Answers1

0

You can't, or you can but with frameworks like Polymer or AngularJS. Take a tour on these page.

Druxtan
  • 1,311
  • 2
  • 15
  • 21