2010-05-17 32 views
0
<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/mootools/1.2.2/mootools-yui-compressed.js"></script> 

<script type="text/javascript" src="sexyalertbox.v1.2.moo.js"></script> 

<link rel="stylesheet" type="text/css" media="all" href="sexyalertbox.css"/> 

<body> 

     <p><a href="#" onclick="Sexy.alert('<h1>hello</h1><p>Please enter a valid email address</p>');return false;">Click here</a></p> 





</body> 

</html> 

當我們點擊這裏時,會出現一個警告框。我想在JavaScript代碼提示框即通過moo工具提醒警告框中的小幫助

alert("Same sexy alert box type alert box"); // hwo to do this?? 

回答

1

劇本後只需補充一點:

Window.prototype.alert = function(message){ 
    Sexy.alert(message); 
}; 

順便說一句。 永不在您的HTML中使用onclicks。在您的JS文件中使用事件處理程序

這是一個工作測試案例:http://jsfiddle.net/bRjcG/3/