//Message prompt information, callback(true/false) callback function
window.shconfirm = function (message, callback)
The callback function parameters are true/false
//message prompt information, callback(msg) callback function (message input by the user), param: regex input regular verification, regexmsg regular verification failed prompt
window.shprompt = function (message, callback, regex, regexmsg)
Here message is the prompt message *
Callback is the callback function * The return parameter is the value entered by the user (userinputmsg)
The two parameters regex and regexmsg are optional and are used to verify user input. Both parameters need to appear at the same time. Cannot be used alone.
The following is the implementation of js,
Currently this is an alert prompt that integrates jquery ui and bootstrap's own encapsulation.
function ShConfirm() {
shconfirm("Are you sure you want to do this!", function (result) {
if (result) {
alert("Clicked OK");
} else {
alert("Clicked Cancel");
}
});
}
function ShPrompt() {
shprompt("What is 1 1 equal to?", function (text) {
alert("The user entered: " text);
}, /^d{1,}$/, "Please enter a number!");
}
Just use shalert directly. It has the same effect as js alert.
I have put the source code on Baidu Netdisk. Everyone is welcome to learn and exchange.
Source code download address
http://pan.baidu.com/s/1c00Cl36
This control actually has reconfigurable parts, such as initialization methods, etc. These have not been extracted. Because the task is tight, I will use it like this first.
These issues will be addressed in the next optimization.
The original style is like this, which can be achieved by modifying the referenced css. There are detailed instructions in the demo.
The above is the entire content of this article. How about it, you will benefit a lot.
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn