Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Using JavaScript variables with Coldfusion

Status
Not open for further replies.

powahusr

Technical User
Jan 22, 2001
240
US
I would like to use variables that I create in Javascript, for use outside the <script></script> tags.


Through the use of Javascript, say I want to get the &quot;screen.width&quot; value of the current browser, what would I have to do to use that value in my Coldfusion &quot;OUTPUT&quot; tag.


Example:


I would like to get the value of the width of the screen

<script type=&quot;text/javascript&quot;>
document.write(screen.width)
</script>


And use it here

<cfoutput>
Display Screen width here
</cfoutput>
 
CF executes server-side, long before the user's browser runs it's javascript.

If you want to expose the variable to CF then you need to get the clients screen width, and then make another call to the server with that value as a parameter.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top