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 Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

set variable (cfset) using onclick??

Status
Not open for further replies.

jamestanner

Programmer
Apr 16, 2007
6
GB
im trying to set a variable using cfset dependant on what link is clicked, how can i do this? i cant make it work :eek:(

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

 
:addition:

i've seen this


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

set_the_variable.cfm
---------------------
<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?
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top