var n = 50; window.jQuery || document.write(' '); window.onload = function () { LoadSaying(n); } function LoadSaying(n,c) { ShowSaying("Loading..."); var mydata = 'n=' + n; $.ajax({ async: false, url: 'http://awer.cn/t/say/jsoncallback.asp', // 跨域URL type: 'GET', dataType: 'jsonp', jsonp: 'jsoncallback', //默认callback data: mydata, timeout: 5000, success: function (json) { if (json.say.length != 0) { ShowSaying(json.say); } }, complete: function (XMLHttpRequest, textStatus) { }, error: function (XMLHttpRequest, textStatus) { alert("请求出错."); } }); } function ShowSaying(data) { data = '换' + data; var awer_say = false; if (document.all) { awer_say = document.all['awer_saying']; } else if (document.getElementById) { awer_say = document.getElementById('awer_saying'); } if (awer_say) { awer_say.innerHTML = data; } }