开发者

MooTools: How to Request and Evaluate javascript on a button click

开发者 https://www.devze.com 2023-02-04 13:42 出处:网络
I am using mootools v1.3. I added a click event to button with id as \"submit_details\". All I want is to load an another mootools script on button click event and execute it. I tried a way as below

I am using mootools v1.3. I added a click event to button with id as "submit_details". All I want is to load an another mootools script on button click event and execute it. I tried a way as below

$('submit_details').addEvent('click',function(){
   alert('checkepoint-1');
   myScript = new Asset.javascript('js/main.js',{});
   alert('checkepoint-2');
});

But its not worki开发者_运维百科ng.(It alerts only "checkepoint-1").


Try using without new keyword.

$('submit_details').addEvent('click',function(){
   alert('checkepoint-1');
   myScript = Asset.javascript('js/main.js',{});
   alert('checkepoint-2');
});

For more details, check here.

http://mootools.net/docs/more/Utilities/Assets

0

精彩评论

暂无评论...
验证码 换一张
取 消