خرید بک لینک

Vote count: 0

I have very sparely used Javascript. I am trying to create a dialog box of type prompt which will display a text field.

How it will work:

  1. User clicks on the Flag anchor link.

<a href="/inc/flagged_post.php?id=<?php echo $thought_id;?>"> Flag </a>

  • When the anchor link is clicked, I expect it to open a prompt box, asking why the post is being flagged - similar to stack overflow's. Try flagging this post and you'll see).
  • When Confirm is pressed on the prompt dialog, it will then, and only then execute flagged_post.php.

My issues:

As mentioned, I have very limited knowledge regarding Javascript. At the moment, this is what I have been able to conjure:

function flag_post() {
    var mess = prompt("I am flagging this post because...");    
        document.write("Your reasoning is : " + mess);
        // if confirm is pressed, call flagged_post.php
}

Yes, I realize it isn't much, but seeing sample code online, this is the most I have been able to understand. And I also realize that I haven't called function flag_post() onclick if the anchor tag, this is because im not quite sure on how I can execute flagged_post.php?id=<?php echo $thought_id;?> when confirm is pressed on the prompt.

I need a simply prompt box with a text field where a user can input there reason for flagging the post, then have the option to confirm or cancel their choice. And if confirmed, execute flagged_post.php?id=<?php echo $thought_id;?>.

asked 1 min ago

برچسب: نویسنده: استخدام کار تاريخ: پنجشنبه 27 اسفند 1394 ساعت: 5:11

صفحه بندی