简体   繁体   中英

How to replace default alert box with customize alert box

I tried to make one exam using html forms which would find the incorrect answer and will write the correct answer using alert box. But i want to use another customize alert box.

When i click the submit button i want to open customized alert box.

Using this alert box http://www.abeautifulsite.net/blog/2008/12/jquery-alert-dialogs/

Thank you !!! Thank you !!!


This is the code.

 <SCRIPT Language ="JavaScript"> function ValidateForm(){ result = new Array(); count = 0; if (!document.forms[0].one[1].checked == true) { result[count] = "Question 1. Correct answer is " + document.forms[0].one[1].value + "."; count++; } if (!document.forms[0].two[1].checked == true) { result[count] = "Question 2. correct answer is" + document.forms[0].two[1].value + "."; count++; } if (!document.forms[0].three[0].checked == true) { result[count] = "Question 3. The correct answer is " + document.forms[0].three[0].value + "."; count++; } if (!document.forms[0].four[2].checked == true) { result[count] = "Question 4. The correct answer is " + document.forms[0].four[2].value + "."; count++; } if (result.length > 0) { var vString = ""; for (var i=0; i<result.length; i++) { vString = vString + result[i] + "\\n"; } alert(result.length + " incorrect answer:\\n" + vString); return(false); } else { alert("All of the questions were answered correctly so submit email notice."); return(true); } } </SCRIPT>

assuming you have included jquery and the alerts plugin (js and css) you downloaded from the site you linked to...

replace alert('etc etc')

with jAlert('your message here')

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM