並進行以下測試。該測試具有一個初始函數,用於捕獲表單中的「submit」事件,因此submit btn調用window.addEvent函數。這工作。javascript - 使用mootools從不同的javascript函數調用javascript addEvent函數
我想弄清楚如何從一個單獨的javascript函數,即saveCollegedata函數調用window.addEvent函數。
通過網絡查看網站,還沒有拿出正確的方法來做到這一點。雖然關於做一個document.forms ['myform']。提交(),但這是行不通的。
也想到做一個onSubmit從窗體和調用不同的JavaScript函數,但不太確定如何這將起作用,以便能夠在ajax回調中使用「this.send」。
function saveCollegeData()
{
var t;
t="tt";
alert("t="+t);
// window.top.fireEvent('domready');
// document.forms["adminForm"].submit();
t="tt";
}
//-generate the 2nd coldata frm to mod the data
//-uses the mod-collegedata1.frm page
//-user confirms the data
window.addEvent('domready', function() {
$('adminForm').addEvent('submit', function(e) {
//Prevents the default submit event from loading a new page.
new Event(e).stop();
//alert (foo);
alert ('11111111aaaa ');
//--clear out the div to start.. just in case..
clearJorge();
//--set/reset the task item to the task for
//--the server side.. was set to "" for the toolbar
//-- the "this" should refer to the $('adminForm') form
this.task.defaultValue="mdata2";
.
.
.