开发者

How to replace javascript alert with a jquery dialog box? [duplicate]

This question already has answers here: Closed 11 years ago.

Possible Duplicate:

How to replace javascript alert (which pops up where the event called it) with a jquery dialog box?

Fellows, I'm going to break it down a little clearer. When I look at that JQuery UI stuff, I get absolutely confused as to what I need to download and where to put the files.

What I DID just do successfully was to link to the JQuery website so that I didn't have to download anything and saw that the dialog box works.

However, the dialog box, from the example shown me, is linked to a div. That div is not going to help me if it's at the top of the screen and the input box is at the bottom. I have only one function in the header that is called from a number of textboxes. This function includes a javascript alert() with a message.

PLEASE, tell me the EXACT code I need to type in the function that will pop up a message wherever the MyFunction is being envoked..

If it was javascript, in the head section in a script we'd have:

<script type="text/javascript">

function digitsOnly(){
alert("Digits only, please");
}

</script>

and in a number of textboxes, we'd have:

<input type="test/javascript" onkeydown="digitsOnly()" />

I need a beautiful pop-up box to replace the javascript alert开发者_C百科(); I don't need this do do anything other than pop up a message next to the calling textbox. If it's draggable and resizable, that would be the coolest thing. But for now, I'll be happy with what I mentioned..

I study languages all the time. I know I'll eventually learn JQuery too. But I need this done tonight if possible.

James


Following is a very useful link for making a customized Dialog box: http://www.queness.com/post/1696/create-a-beautiful-looking-custom-dialog-box-with-jquery-and-css3

You need to do the following: 1. Make a DIV element in the HTML body (as given in the link) 2. copy the CSS given into a CSS file and include it in your HTML 3. Include the JQuery's JS file using the following in HTML head:

<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.3/jquery.min.js"></script>
  1. Write the javasript given in the header section witin tags.
  2. OnClick of textbox call the method : popup("")

On any page where you want this dialog box, the js file having the javascript and the css file must be inluded, so make a seperate js and css file for reusability.

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜