Hello,
I have a script tag in my jsp:
<script> var tooltip = <%=tooltipMenu%> </script>
I need to use tooltip variable in a javascript file (meunExpandable.js).
How can I do that?
Except for forgetting the quotes around the string, what's the problem?
Once loaded, all JavaScript is in the same namespace so whether script is in a .jjs file or not is moot.`Of course, you can;t reference something before it's defined, so order counts if the script is inline.
LOOK at your JavaScript. Not in your source, but what is being delivered to the browser (do a View Source).
Is it the correct syntax?
Brucaliffo John
Greenhorn
Joined: Jan 20, 2009
Posts: 29
posted
0
I'm sorry,
Are you talking about HTML generated?
The html code is correct, the page is all right.
it's just I can't access var tooltip I declared in jsp.
Brucaliffo John
Greenhorn
Joined: Jan 20, 2009
Posts: 29
posted
0
I get this html:
and the alert window shows "undefined"
but tooltip should be defined.
I'm wrong?
Thank You
Brucaliffo John
Greenhorn
Joined: Jan 20, 2009
Posts: 29
posted
0
OK thank you for your precious support.
I resolved the problem.
John
Eric Pascarello
author
Rancher
Joined: Nov 08, 2001
Posts: 15357
6
posted
0
So you saw the problem with
Eric
Brucaliffo John
Greenhorn
Joined: Jan 20, 2009
Posts: 29
posted
0
So you saw the problem with
<script>var tooltip = ORCOBIO</script>
<script>var tooltip = ORCOBIO</script>
Eric
Yes
Brucaliffo John
Greenhorn
Joined: Jan 20, 2009
Posts: 29
posted
0
another little question:
I have to set onmouseover value in my javascript file.
variable.title = "test"; works fine
variable.onmouseover = "test"; doesn't work
why?
wich is the correct syntax to set onmouseover?