Results 1 to 4 of 4

Thread: calling JS function from a hyperlink

  1. #1

    Thread Starter
    Fanatic Member davebat's Avatar
    Join Date
    Dec 2002
    Posts
    727

    calling JS function from a hyperlink

    how do i call ajavscript fucntion from my hyprlink

  2. #2

    Thread Starter
    Fanatic Member davebat's Avatar
    Join Date
    Dec 2002
    Posts
    727
    VB Code:
    1. <script language="JavaScript">
    2. function checker(whichform){
    3. var agree=confirm("Are you sure you wish to continue? This\nwill send an email to all Sales Managers!");
    4. if (agree){
    5.     document.whichform.submit();
    6. }
    7. }
    8. </script>

    ive manages to call this using a hyperlink:

    VB Code:
    1. <a href="javascript:checker('initial');"><font size="2" face="Verdana">Initial Request</font></a>


    and i have set up the form to be submited at the bottom of the page

    VB Code:
    1. <form action="orion_s004.asp" method="post" name="initial" target="_self">
    2.    <input type="hidden" name="F_PROFILE" value="<%response.write V_PROFILE%>">
    3.    <input type="hidden" name="F_ACCESS" value="<%response.write V_ACCESS%>">
    4. </form>

    this works except its trying to submit a fortm caled whichform, when the whichform is a variable which should read 'initial'. I can send the form nuimber up and do it that way but id like to know why this deosnt work

  3. #3
    Stuck in the 80s The Hobo's Avatar
    Join Date
    Jul 2001
    Location
    Michigan
    Posts
    7,256
    try:

    Code:
    document.forms(whichform).submit();
    My evil laugh has a squeak in it.

    kristopherwilson.com

  4. #4

    Thread Starter
    Fanatic Member davebat's Avatar
    Join Date
    Dec 2002
    Posts
    727
    thanks, that works great

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width