Steve Steve - 4 months ago 44
Javascript Question

Modal Dialog in Javascript

I am new to web development. I am currently using a .js modal dialog box that I found on the internet that is ok for now. What I want to know is, is there a nicer way to do this. Should I look at using jquery?



You can try the popular Prototype JS library. Here's how you would do it in Prototype. The idea will be very similar in nearly all other JS libraries.


<div style="display: none" id="message"></div>


#message {
 position: absolute;
 left: 40%;
 top: 40%;


function modal(text) {

modal('Any text you want to appear in the modal box');