日期:2014-05-16  浏览次数:20381 次

Struts2 jQuery Plugin Showcase Version 3.2.0 用到的所有JS归类

/*

?* Function for Theme Handling

?*

?*/

function changeTheme(newTheme) {

if (newTheme=='showcase')

themePathPrefix = "themes/";

else {

themeHref = $('#jquery_theme_link').attr('href');

if ($("#google").attr('checked')) {

if (themeHref.indexOf("http:")==0) {

prefixIndex = themeHref.indexOf("themes/")+7;

themePathPrefix=themeHref.substring(0,prefixIndex);

}

else {

$("#themeform").submit();

return false;

}

}

else {

themePathPrefix = "struts/themes/";

}

}

$('#jquery_theme_link').attr('href',themePathPrefix+newTheme+'/jquery-ui.css');

}

?

/*

?* Function for Custome Validation Example

?*

?*/

function customeValidation(form, errors) {

?

// List for errors

var list = $('#formerrors');

?

// Handle non field errors

if (errors.errors) {

$.each(errors.errors, function(index, value) {

list.append('<li>' + value + '</li>\n');

});

}

?

// Handle field errors

if (errors.fieldErrors) {

$.each(errors.fieldErrors, function(index, value) {

var elem = $('#' + index + 'Error');

if (elem) {

elem.html(value[0]);

elem.addClass('errorLabel');

}

});

}

}

?

/*

?* Function for Tree Node Delete Example

?*

?*/

function deleteTreeNode(url, obj) {

$("#result2").load(url +"?echo=Delete%20Node%20"+obj[0].id);

}

?

$(document).ready(function() {

?

$.subscribe('changeTextfield', function(event, data) {

$('#result').html('Textfield '+data.id+' value is '+data.value);

});

?

/*

* Subscribe Topics for AJAX Link Event Example

*/

$.subscribe('beforeLink', function(event, data) {

alert('Before request ');