2

I'm trying to create a popup after a user successfully sells a stock. I want it to look like Chrome's confirm form resubmission popup Popup

I'm pretty sure I need javascript, html, and css, but I'm not sure how to do it.

Thanks,

David

1
  • If you know how to program another type of popup that's fine, please tell me how.
    – i_am_david
    Commented Jul 23, 2015 at 15:38

1 Answer 1

1

If you want to use the popup window for any browser you probably want to use javascript. The popup window you have above is called a confirmation box. Here is how to use it:

function foo() {
    confirm("Message to be displayed");
}

The above function should be inside a <script> tag.

Then on your <input> tag with type="submit" also define the onclick attribute like that:

<input type="submit" value="submit" onclick="return foo();" />

You can learn more here: http://www.w3schools.com/js/js_popup.asp

17
  • Where would I put this js (what folder- public or templates) and also how would I make my php code run it?
    – i_am_david
    Commented Jul 23, 2015 at 19:55
  • chris[reputation] = chris[reputation] + 35;
    – i_am_david
    Commented Jul 23, 2015 at 19:56
  • You can put it in the <head> part of your HTML code. And you can have HTML code in your PHP file. Ha thanks for the other comment. I'm sorry if I appeared hostile with your Q&As. Just like you I'm trying to make this site better, and those where the questions in my review queue.
    – ChrisG
    Commented Jul 23, 2015 at 20:01
  • Thanks, all forgiven and forgotten.
    – i_am_david
    Commented Jul 23, 2015 at 20:02
  • Also check the link at the end of my answer and take a look at the try out's.
    – ChrisG
    Commented Jul 23, 2015 at 20:02

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .