开发者

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 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

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜