Coding problem here!!

Sharky Forums


Results 1 to 3 of 3

Thread: Coding problem here!!

  1. #1
    Tiger Shark ToMo's Avatar
    Join Date
    Jul 2003
    Location
    HERE
    Posts
    922

    Coding problem here!!

    Ok, I have an ASP page that draws a table with a recordset, each record being a table row. I want to add a last column in the table that will have a remove link that when clicked will pop up a confirm box and if clicked ok, will update a field in the record and will redraw the table without that record. I have the code to do the confirm box in javascript, I just have no idea how I would pass the unique id to another asp page that would handle the database update. Im pretty sure you can't embed ASP inside of a javascript. Any suggestions?

    Here is the javascript i was trying to use:

    <script language="JavaScript">
    <!--
    function confirm_entry()
    {
    input_box=confirm("Click OK or Cancel to Continue");
    if (input_box==true)

    {
    // Output when OK is clicked
    alert ("Pending Certificate Canceled");
    window.location="remove_pend.asp?id=idunnowhattodohere!"
    }

    else
    {
    // Output when Cancel is clicked
    alert ("You clicked cancel");
    }

    }
    -->
    </script>
    <td bgcolor="#EEEEEE" style="color:black;"><font style=""color:#0000CC; text-decoration:none;""><a href="JavaScript:confirm_entry()">Remove</a></font></td>
    P5W DH Deluxe | C2D E6600 | 4x1gb PC900 | 2x250gb WD Raid 0 | CPNPS9500 w/ AS5 | X-Fi XtremeMusic | eVGA 8800GTS 320mb | TruePower 550w | Acer AL2423W
    XBLA:Rott3n | xfire:tomo78

  2. #2
    Ex-*** kid A's Avatar
    Join Date
    Sep 2000
    Location
    Norway
    Posts
    5,322
    Can't you just pass the record ID to the JS function, then append it to the
    Code:
    window.location="remove_pend.asp?id=idunnowhattodohere
    in place of idunnowhattodohere?

    You can pass pretty much anything to a function:

    Code:
    <a href="JavaScript:confirm_entry('<%recordId%> ')">Remove</a>
    Then use it in your function like this:

    Code:
    function confirm_entry(recordId)
    {
    input_box=confirm("Click OK or Cancel to Continue");
    if (input_box==true)
    
    { 
    // Output when OK is clicked
    alert ("Pending Certificate Canceled");
    window.location="remove_pend.asp?id=recordId" 
    }
    Is this what you mean?
    Last edited by kid A; 02-04-2004 at 08:20 PM.
    Now listening to various rock and metal
    143rd member to join Sharkyforums.

  3. #3
    Tiger Shark ToMo's Avatar
    Join Date
    Jul 2003
    Location
    HERE
    Posts
    922
    Ok, i figured it out!! All I had to do was after -window.location="remove_pend.asp?id=
    i just added <%= rs("CertId")%>"

    ie -window.location="remove_pend.asp?id=<%= rs("CertId")%>"

    Thanks for the help Kid A
    P5W DH Deluxe | C2D E6600 | 4x1gb PC900 | 2x250gb WD Raid 0 | CPNPS9500 w/ AS5 | X-Fi XtremeMusic | eVGA 8800GTS 320mb | TruePower 550w | Acer AL2423W
    XBLA:Rott3n | xfire:tomo78

Posting Permissions

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