If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

 
Go Back  dBforums > Data Access, Manipulation & Batch Languages > ASP > Using onClick in <A Href="abc.asp"> - ASP & VBScript

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old 09-09-04, 11:19
rweide rweide is offline
Registered User
 
Join Date: Aug 2004
Location: USA
Posts: 54
Using onClick in <A Href="abc.asp"> - ASP & VBScript

I am trying to use onClick event inside the

<A Href="abc.asp" onclick= "call a Sub or Function">Click here</A>,

so that when user clicks the 'Click Here' link, instead of going directly to the specified link, I will call the Subroutine (or Function) to check his security level to decide if he can go on to the link, or be rejected (i.e. not respond to his click except just displaying a message to let him know).

Can anyone help me with this? Thanks.
Reply With Quote
  #2 (permalink)  
Old 09-10-04, 13:03
Seppuku Seppuku is offline
Useless...
 
Join Date: Jul 2003
Location: SoCal
Posts: 721
You're trying to cross Server-Side and Client-Side programming. The best way you're going to accomplish this would be to use some JavaScript to submit the login info to a hidden IFrame which would validate the credentials, and either display an error, or set a cookie/session and redirect the user to the secured page.

Personally, I don't use IFrames for this purpose. I simply submit the credentials on the same page and attempt to authenticate. If it fails, I redirect them back to the original login form with an error message, otherwise I redirect them to the secured page.

What is the business need, or is strictly aesthetic?
__________________
That which does not kill me postpones the inevitable.
Reply With Quote
  #3 (permalink)  
Old 09-10-04, 14:25
rweide rweide is offline
Registered User
 
Join Date: Aug 2004
Location: USA
Posts: 54
Thanks for the direction.

Now, I have another related question, and here's my codes:

<A href="<%=some file%>" target="_blank"
onClick="window.open ('<%=some file%>','','width=950,height=600,scrollbars=yes,me nubar=yes');return false;">
Click Here</A>


Here, when users click the link, it will open a new window (with the pre-determined features and sizes, etc.).

But now, I need to use an ASP IF statement to check some condition so that if the condition is FALSE, I will still show the words "Click Here" without the underline and also ignoring the onClick event. How do I insert this IF statement in this <A></A> tag?

Basically, I am trying to wrap an ASP <%IF...Then %> statement around this following line:

onclick="open('<%=some file%>','','');return false;

But I have <% %> already inside this onClick event?!

Last edited by rweide; 09-10-04 at 14:35.
Reply With Quote
Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On