View Full Version : anchor and href question

11-19-2002, 09:03 PM

I am trying to create a anchor tag with 2 functions but I don't know how to do it :

I need to run a javascript to validate data and then I want to link to a different page. If you have other suggestions please let me know too.

Please help ASAP 'cos I need to finish this project soon.

Thanks a lot!


11-19-2002, 09:31 PM
can we see a link to the page you're working on, or could you post the code? also, since this is a javascript question, it really belongs in the JavaScript forum. so that you know for the next time.

11-19-2002, 09:49 PM
Below is the codes that I am working on:
validdateandsubmit = validate all data on the form and submit
setflag = change a flag in the database

action.append("<td class=\"bgMenu\"><div class=\"LinkOnBgMenu\" style=\"text-align:center;padding:2px;padding-bottom:4px;\">&nbsp;<A href= \"javascript:validateAndSubmit();\"/"+db.getFilePath().replace('\\','/')+"/(changeflag)?openAgent&taskID="+taskID+"&login\" class=\"LinkColorOnBgMenu\">go to products</a>&nbsp;</div></td><td width=\"20\">&nbsp;</td>");

Thanks again!

11-20-2002, 05:54 AM
try this:

action.append('<td class="bgMenu"><div class="LinkOnBgMenu" style="text-align:center;padding:2px;padding-bottom:4px;"> <A href="'+db.getFilePath().replace("\\","/")+'/(changeflag)?openAgent&taskID='+taskID+'&login" onClick="validateAndSubmit();" class="LinkColorOnBgMenu">go to products</a> </div></td><td width="20"> </td>');

11-20-2002, 03:49 PM
Hey, John,

It works... thanks a lot.
I have another question ... if I need to put another function to onClick, is this what I should do -

openAgent&taskID='+taskID+'&login" onClick="validateAndSubmit(); SECONDFUNCTION()"

Thanks again.:o

11-20-2002, 04:35 PM
yep. that's it exactly.