开发者

Modal Dialog in Javascript

开发者 https://www.devze.com 2023-02-02 17:00 出处:网络
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 th开发者_StackOverflowere a nicer way to do this.Shou

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 th开发者_StackOverflowere a nicer way to do this. Should I look at using jquery?

Thanks


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.

HTML:

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

CSS:

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

JS:

function modal(text) {
 $('message').update(text);
 $('message').appear();
}

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


Try to use jquery fancybox. It's great and works as well"

0

精彩评论

暂无评论...
验证码 换一张
取 消