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

Mergin' cfml tag into javascript event!

Status
Not open for further replies.

someonecalled

Programmer
Jan 23, 2001
3
AE
Dear reader,
To understand what i wanna do clearly, see the followin' code that i tried to make it work:
<td bgcolor=&quot;ffffff&quot; onclick=&quot;<cflocation url='index.cfm'>&quot;></td>

The problem is that when i call the page that includes the above statement, it takes me directly to index.cfm ... i mean that the event (onclick) executes without clickin' the TD!!!!

can ya help?
with regards! <ikramy>with regards</ikramy>
 
solution 1
----------
you should write a jscript function (say : relocate() ) and put it between the script tags :
<html>
<head>
<script langage=javascript>
function relocate() {
<cflocation url=&quot;index.cfm&quot;>
}
</script>
...
</head>
<body>
...
<td bgcolor=&quot;ffffff&quot; onclick=&quot;relocate()&quot;></td>
...


solution 2
----------
use directly pure javascript :
...
<td bgcolor=&quot;ffffff&quot; onclick=&quot;document.location='index.htm'&quot;></td>
...
 
iza and ikramy, the first solution won't work (CF will always execute any CFLOCATION in a page, unless it never gets there, for example when you use an IF...ELSE statement...). The second solution is correct though. Good luck!

<webguru>iqof188</webguru>
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top