Log In

Come Join Us!

Are you a
Computer / IT professional?
Join Tek-Tips Forums!
  • Talk With Other Members
  • Be Notified Of Responses
    To Your Posts
  • Keyword Search
  • One-Click Access To Your
    Favorite Forums
  • Automated Signatures
    On Your Posts
  • Best Of All, It's Free!
  • Students Click Here

*Tek-Tips's functionality depends on members receiving e-mail. By joining you are opting in to receive e-mail.

Posting Guidelines

Promoting, selling, recruiting, coursework and thesis posting is forbidden.

Students Click Here


set variable (cfset) using onclick??

set variable (cfset) using onclick??

set variable (cfset) using onclick??

im trying to set a variable using cfset dependant on what link is clicked, how can i do this? i cant make it work :o(

my code is:

<a href="javascript:document.myform.submit()" class="newsimage" onclick="return <cfset prop_brand='fr0002'>; <cfset prop_name='Cava + Glasses'>; <cfset prop_description='Perfect for center of table'>; <cfset prop_ref='Freixenet'>" onmouseover= "document.getElementById('brandsite').innerHTML='ref: <span class=brandlink> FR0002</span>';document.getElementById('description').innerHTML='freixenet cava<br><br>looks ideal in the center of a dinner table'; document.getElementById('product').innerHTML='freixenet cava + glasses'; changeImages('image2','image2on', 'otherImage', 'otherImage2')" onMouseOut="document.getElementById('brandsite').innerHTML='ref: '; document.getElementById('product').innerHTML='';document.getElementById('description').innerHTML=''; changeImages('image2','image2off', 'otherImage','otherImageDefault')"><img src="images/catalogue/fr0002.gif" alt="fr" name="image2" width="72" height="72" hspace="0" vspace="0" border="0" id="image2"></a>

There are 6 of these on my page (the fr numbers are different as are the image rollovers) but it always sets the values as the last link!!???

when i click on any image, the CFSET does not get set?

how can i achieve this??

Many thanks

RE: set variable (cfset) using onclick??


i've seen this

<a href="set_the_variable.cfm?animal=leo"> {your image} </a>

<cflock scope="session" type="exclusive" timeout="30"><cfset session.animal = #url.animal#></cflock>
<cflocation url="my_original_page.cfm" addtoken="no">

as a solution but how would i then make the form submit on return?

Red Flag This Post

Please let us know here why this post is inappropriate. Reasons such as off-topic, duplicates, flames, illegal, vulgar, or students posting their homework.

Red Flag Submitted

Thank you for helping keep Tek-Tips Forums free from inappropriate posts.
The Tek-Tips staff will check this out and take appropriate action.

Reply To This Thread

Posting in the Tek-Tips forums is a member-only feature.

Click Here to join Tek-Tips and talk with other members!

Close Box

Join Tek-Tips® Today!

Join your peers on the Internet's largest technical computer professional community.
It's easy to join and it's free.

Here's Why Members Love Tek-Tips Forums:

Register now while it's still free!

Already a member? Close this window and log in.

Join Us             Close