Javascript variables

brian18
Posts: 23
Joined: Mon Jan 29, 2001 10:18 am

Javascript variables

Post by brian18 »

I know I did this before, but I can't find the code I wrote. I need to get the value of a javascript variable into a vortex variable. Here is some sample code:

<a name="moon">
<verb noesc>
<SCRIPT LANGUAGE="JavaScript">
</verb>
function getValues() {
mediaForm.hiddenContent.value=opener.document.contentForm.content.value;
moo=opener.document.contentForm.content.value;
}
<verb noesc>
</SCRIPT>
</verb>
<BODY onLoad="getValues()">
<FORM METHOD="POST" NAME="mediaForm" ACTION="/cgi-bin/texis/cls/course">
<INPUT TYPE="HIDDEN" NAME="hiddenContent">
$moo
</BODY>
</A>

Thanks!!!!

Brian
User avatar
mark
Site Admin
Posts: 5519
Joined: Tue Apr 25, 2000 6:56 pm

Javascript variables

Post by mark »

Assuming your javascript sets hiddenContent to the desired value you can access it in vortex as $hiddenContent .
brian18
Posts: 23
Joined: Mon Jan 29, 2001 10:18 am

Javascript variables

Post by brian18 »

You wuld think that was true, but the hidden field only allows acces of the variable on the next html page, not this one.
User avatar
John
Site Admin
Posts: 2623
Joined: Mon Apr 24, 2000 3:18 pm
Location: Cleveland, OH

Javascript variables

Post by John »

Correct, Vortex runs on the server to generate the page that is sent to the browser. Once the HTML reaches the browser the browser runs the Javascript and Vortex is no longer involved.

If you need the value in a Vortex variable then it will need to be passed in the HTTP request somehow. If you are trying to display it as in your example you could use javascript again to display it on the client.
John Turnbull
Thunderstone Software