• Check out the results of the Techtree Contest #19!
  • Listen to a special audio message from Bill Roper to the Hive Workshop community (Bill is a former Vice President of Blizzard Entertainment, Producer, Designer, Musician, Voice Actor) 🔗Click here to hear his message!
  • Read Evilhog's interview with Gregory Alper, the original composer of the music for WarCraft: Orcs & Humans 🔗Click here to read the full interview.
  • Create a void inspired texture for Warcraft 3 and enter Hive's 34th Texturing Contest: Void! Click here to enter!
  • The Hive's 22nd Icon Contest: Creep Abilities is now concluded, time to vote for your favourite set of icons! Click here to vote!

How to make a Popup using HTML/Javascript?

Status
Not open for further replies.
I'll cut it short. Pretty much I'm not that good of a coder yet, especially with this kind of stuff, but I really need help solving it.

So, the case is about popup (I know bunch of people hate em, but I need this one done). What I currently need are :
1. Dimming the page while the popup is active
2. Locking the popup to the middle of the page
3. Run an auto close after X second
 
http://www.w3schools.com/js/js_popup.asp

This is what you're looking for I suppose.

If you want an alert to appear and disappear after a specified interval has passed, then you're doomed.
When an alert has triggered, the browser stops processing the js code until the user clicks "Ok".
This happens again when a confirm or prompt is shown.

OR:
http://stackoverflow.com/questions/18650494/disappear-the-alert-box-with-time-based
^pure JS Bin dialog custom alert

You can use jqueryUI (-> Dialog widget) too.
Further stuff: https://blog.udemy.com/jquery-popup-window/

I'd use jquery for that - it's highly customizable and fairly easy to get into...

http://www.w3schools.com/jsref/met_win_settimeout.asp
may also benefit your thing
 
I'll cut it short. Pretty much I'm not that good of a coder yet, especially with this kind of stuff, but I really need help solving it.

So, the case is about popup (I know bunch of people hate em, but I need this one done). What I currently need are :
1. Dimming the page while the popup is active
2. Locking the popup to the middle of the page
3. Run an auto close after X second

You know, stackoverflow is your place for programming. As much as I love hive, 99% of the time i just ask on stackoverflow... lightning fast answers, on the point. Also googling tutorials helps too.


This site is hated among devs. You can google the reasons. My advice:
- its okay for short syntax check or their online try-it-editor
- don't follow their tutorials blindly
- don't use it for references. people hate it for reasons older than you and me (often called w3fools)
 
its pretty easy to do.

give the background a name. I should have one already but it's better if you give it one. my backgrounds are always called, 'gameback'

then write.

gameback.setenabled(false);
JOptionpane.showMessageDialogue(null,"pop up message.what ever you want it to be");
timer ();
gameback.setEnabled(true);

then using a thread timer, you will have to Google how to use threads.

write

public timer(){
Thread.yield();
Thread.sleep(8000);
}
this will make the pop up window last 80 seconds and if you click something on the pop up it will then resume the gameback

I hope this helps you Daffa! the thread will provably be the hardest part
 
Status
Not open for further replies.
Back
Top