SitePoint Sponsor

User Tag List

Results 1 to 5 of 5
  1. #1
    SitePoint Addict thoresson's Avatar
    Join Date
    Dec 2002
    Location
    Gothenburg, Sweden
    Posts
    255
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    js newbie: need help with popup window

    Hi,

    I'm building a PHP/MySQL site at the moment. Administrators should be able to delete from the tables, but when they choose so, I want to show a JavaScript box with a Y/N question "Are your sure you want to delete". If no is pressed, the previous php-page should be viewed again, if yes is pressed to rest of the present php-page should be processed deleting from the MySQL database.

    I know zip and nada about JS. Is this hard to do?

    Best regards,

    Anders Thoresson

  2. #2
    Sultan of Ping jofa's Avatar
    Join Date
    Mar 2002
    Location
    SvÝ■jˇ­
    Posts
    4,080
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Some sort of message box where the user can confirm that they want to delete?
    How about confirm()
    http://devedge.netscape.com/library/...w.html#1201914

    Something like
    <input type="submit" ... onclick="return confirm('Do you really want to...');">

  3. #3
    SitePoint Addict thoresson's Avatar
    Join Date
    Dec 2002
    Location
    Gothenburg, Sweden
    Posts
    255
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Quote Originally Posted by jofa
    <input type="submit" ... onclick="return confirm('Do you really want to...');">
    It's not a form I'm using, but an ordinary link. Usable with <a href..> as well?

    //Anders

  4. #4
    Web-coding NINJA! silver trophy beetle's Avatar
    Join Date
    Jul 2002
    Location
    Dallas, TX
    Posts
    2,900
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Same process. onclick can be applied to most any element.

    <a href="somelink" onclick="return confirm('Do you really want to...');">Link</a>
    beetle a.k.a. Peter Bailey
    blogs: php | prophp | security | design | zen | software
    refs: dhtml | gecko | prototype | phpdocs | unicode | charsets
    tools: ide | ftp | regex | ffdev




  5. #5
    Sultan of Ping jofa's Avatar
    Join Date
    Mar 2002
    Location
    SvÝ■jˇ­
    Posts
    4,080
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    The reference at devedge.netscape.com is always useful...
    http://devedge.netscape.com/library/...s.html#1119876


Bookmarks

Posting Permissions

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