我的脚本的语法问题

这是原始剧本……

$j(document).ready(function() { //Show and hide the Loading icon on Ajax start/end $j('.bwbps_uploadform').submit(function() { $j('#bwbps_message').html(''); bwbpsAjaxLoadImage(this); return false; }); //make sure the upload form radio button is on Select file $j(".init_radio").attr("checked","checked"); //Add OnClick to the Mass Update Buttons in the PhotoSmash Settings form if ($j('#bwbps_gen_settingsform').val() == '1') { bwbpsAddPSSettingsMassUpdateActions(); } $j('.bwbps-post-cat-form').attr('multiple','multiple'); } }); 

我想更改此脚本以在另一个函数中调用它,但firebug中存在语法错误:

 var myFunction; $j(document).ready(function() { //Show and hide the Loading icon on Ajax start/end myFunction = function() { $j('.bwbps_uploadform').submit(function() { $j('#bwbps_message').html(''); bwbpsAjaxLoadImage(this); return false; }); //make sure the upload form radio button is on Select file $j(".init_radio").attr("checked","checked"); //Add OnClick to the Mass Update Buttons in the PhotoSmash Settings form if ($j('#bwbps_gen_settingsform').val() == '1') { bwbpsAddPSSettingsMassUpdateActions(); } $j('.bwbps-post-cat-form').attr('multiple','multiple'); } }); 

怎么了? 有谁能够帮我??

 var $j = jQuery.noConflict(); 

谢谢你的帮助!

使用这样:

  var myFunction; $j(document).ready(function() { //Show and hide the Loading icon on Ajax start/end myFunction = function($j) { $j('.bwbps_uploadform').submit(function() { $j('#bwbps_message').html(''); bwbpsAjaxLoadImage(this); return false; }); //make sure the upload form radio button is on Select file $j(".init_radio").attr("checked","checked"); //Add OnClick to the Mass Update Buttons in the PhotoSmash Settings form if ($j('#bwbps_gen_settingsform').val() == '1') { bwbpsAddPSSettingsMassUpdateActions(); } $j('.bwbps-post-cat-form').attr('multiple','multiple'); } }); 

在myFunction中传递$ j作为参数