不是一个JS男人 - 所以任何人都可以解释为什么这不起作用?我想从简单的AJAX脚本中调用一个脚本中的预定义函数 - 我只是希望它通过AJAX将div内容带入页面时调用qtip功能。调用jquery函数和传递变量
感谢, ^ h
脚本1 - AJAX装载机
if(myHttpRequest.readyState==4)
data.innerHTML = myHttpRequest.responseText;
qtip_me('.div_to_act_on');
}
脚本2 - 主jQuery脚本
$(document).ready(function() {
function qtip_me(a) {
$(a).each(function() {
$(this).qtip({
content: {'showme'},
position: {corner: {tooltip: 'bottomLeft', target: 'topRight'}},
style: {
width: 300,
padding: 5,
background: '#A2D959',
color: 'black',
textAlign: 'center',
border: {
width: 7,
radius: 5,
color: '#A2D959'
},
tip: 'bottomLeft',
name: 'dark' // Inherit the rest of the attributes from the preset dark style
}
});
});
};
});
摆脱$(document).ready(function(){'和相应的结束'});''。你只是定义一个函数,你不需要它。 – 2009-11-29 13:47:11
尽管存在争论,干杯家伙 - “范围”绝对是它) – MrFidge 2009-12-01 11:17:09