这是原始剧本......
$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();
感谢您的帮助!
答案 0 :(得分:0)
像这样使用:
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作为参数传递