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

is there a way to process an event on a link? 1

Status
Not open for further replies.

frogggg

Programmer
Jan 17, 2002
182
US
On my hello username box in the corner, I had the "If you are not USername, please login." With login being an href to the home page like this:

if session(&quot;CandID&quot;) <> &quot;&quot; then
dim helloString
helloString = &quot;<h3>Hello &quot; & session(&quot;UserName&quot;) & &quot;!</h3>&quot;
helloString = helloString & &quot;If you are not &quot; & session(&quot;UserName&quot;) & &quot;<br> please &quot;
helloString = helloString & &quot;<a href='default.shtml'>log in.</a>&quot;
Response.Write helloString
else
etc.

I also want to kill the session variable that was obviously created incorrectly when the user clicks the link. Is there a way to have an onClick on an href?
i.e. session(&quot;CandID&quot;) = &quot;&quot;
session(&quot;UserName&quot;) = &quot;&quot;

Thanks in advance for any help.
 
kind of like this????? but with session var's
<html>
<head>
<script language=&quot;VBscript&quot;>
Dim var
var = 1
alert var
sub kill()
var = &quot;&quot;
alert var
end sub
</script>
<body>
<a href=&quot;#&quot; onClick=&quot;kill()&quot;>Kill It</a>

</body>
</html> I may not get it the 1st or 2nd time,
but how sweet that 15th time can be.
 
Thanks!
That worked great.
I wasn't sure if you could put an onClick in an href.
 
glad I helped out frogggg.
Thanks for the star! I may not get it the 1st or 2nd time,
but how sweet that 15th time can be.
 
onClick is an event handler for most DOM elements. You could put it on an image, on a paragraph (so that clicking any of the paragraph text would trigger some function), on a table cell, you name it!

However, I have found that NS4 has many retrictions on where it will work. (your milage may vary - see dealer for details)

If you wanted - you could add an onclick to a <u> tag to create your own <a href> functionality. Why would you want to do that is left as a DHTML assignment. :) Einstein47
(Love is like PI - natural, irrational, endless, and very important.)
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top