2012-11-08 40 views
-1

我試圖使用html表單進行一項檢查,該工具會查找不正確的答案,並使用提醒框編寫正確的答案。但是我想使用另一個自定義警報框。如何使用自定義提醒框替換默認提醒框

當我點擊提交按鈕我想打開自定義警報框。

使用此警告框http://www.abeautifulsite.net/blog/2008/12/jquery-alert-dialogs/

謝謝! 謝謝!!!


這是代碼。

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

+0

這裏有個問題,我看不到? –

+0

是的,它是:當我點擊提交按鈕,我想打開自定義警報框...取代瀏覽器默認警報框 – user1810371

回答

0

假設你已經包括jquery和警報插件(JS和CSS),您從您鏈接到網站上下載...

更換 alert('etc etc')

jAlert('your message here')