function $(v){
return document.getElementById(v);
}function $n(n, index){
var es = document.getElementsByName(n);
if (typeof(index) == 'undefined') {
index = 0;
}
if (index >= es.length) {
index = es.length - 1;
}
return es[index];
}function Ajax(url, params, callback, method) {
this.createHttpRequest = function() {
if (window.ActiveXObject) {
try {
return new ActiveXObject('Msxml2.XMLHTTP');
} catch (e) {
return new ActiveXObject("Microsoft.XMLHTTP");
}
} else {
return new XMLHttpRequest();
}
}
this.url = url;
this.params = params;
this.callback = callback;
this.method = method == null? "post" : method;
this.xmlHttp = this.createHttpRequest();
window.myAjax = this;
this.doRequest = function() {
var query = "";
for (var param in this.params) {
if (query != "") {
query += "&";
}
query += param + "=" + this.params[param];
} if (this.method == "post") {
this.xmlHttp.open(this.method, this.url, true);
this.xmlHttp.onreadystatechange = this.stateChanged;
this.xmlHttp.setRequestHeader('Content-Type','application/x-www-form-urlencoded');
this.xmlHttp.send(query);
} else {
if (query.length>0) this.url += "?" + query;
try {
this.xmlHttp.open(this.method, this.url);
} catch (err) {}
this.xmlHttp.setRequestHeader('Content-Type','text/html; charset=gbk');
this.xmlHttp.setRequestHeader('Cache-Control', 'no-cache');
this.xmlHttp.setRequestHeader('X-Powered-KW', '1');
this.xmlHttp.onreadystatechange = this.stateChanged;
this.xmlHttp.send(null);
//return this.xmlHttp.responseBody;
}
};
this.stateChanged = function() {
if (myAjax.xmlHttp.readyState==4 || myAjax.xmlHttp.readyState=="complete") {
var data = myAjax.xmlHttp.responseText;
myAjax.callback(data);
}
};
}function outputContent(uri){
$("text_area").innerHTML = "<font style='color:blue;font-size:24px'>正在加载章节内容,请稍后...</font>";
var fullurl = "";
var defaulturl = "http://"+document.domain+"/";
var s = Math.round(Math.random()*2);
if (s == 0)
{
defaulturl += "ebak"+uri;
}
else
{
defaulturl += "egbk"+uri;
}
fullurl = defaulturl;
var ajax =new Ajax(fullurl, null, showContent, "get");
ajax.doRequest();
}function showContent(message) {
if (message.length >0) {
message = message.replace(/ /g, " ")
message = message.replace(/\n/g, "<br />");
}
else
{
message = '<font style="color:red;font-size:24px">获取内容失败,请<a href="#" onclick="window.location.reload();">点此刷新</a>本页面重新获取...</font>'
}
$("text_area").innerHTML = message;
LoadSet();
//alert(message);
}
return document.getElementById(v);
}function $n(n, index){
var es = document.getElementsByName(n);
if (typeof(index) == 'undefined') {
index = 0;
}
if (index >= es.length) {
index = es.length - 1;
}
return es[index];
}function Ajax(url, params, callback, method) {
this.createHttpRequest = function() {
if (window.ActiveXObject) {
try {
return new ActiveXObject('Msxml2.XMLHTTP');
} catch (e) {
return new ActiveXObject("Microsoft.XMLHTTP");
}
} else {
return new XMLHttpRequest();
}
}
this.url = url;
this.params = params;
this.callback = callback;
this.method = method == null? "post" : method;
this.xmlHttp = this.createHttpRequest();
window.myAjax = this;
this.doRequest = function() {
var query = "";
for (var param in this.params) {
if (query != "") {
query += "&";
}
query += param + "=" + this.params[param];
} if (this.method == "post") {
this.xmlHttp.open(this.method, this.url, true);
this.xmlHttp.onreadystatechange = this.stateChanged;
this.xmlHttp.setRequestHeader('Content-Type','application/x-www-form-urlencoded');
this.xmlHttp.send(query);
} else {
if (query.length>0) this.url += "?" + query;
try {
this.xmlHttp.open(this.method, this.url);
} catch (err) {}
this.xmlHttp.setRequestHeader('Content-Type','text/html; charset=gbk');
this.xmlHttp.setRequestHeader('Cache-Control', 'no-cache');
this.xmlHttp.setRequestHeader('X-Powered-KW', '1');
this.xmlHttp.onreadystatechange = this.stateChanged;
this.xmlHttp.send(null);
//return this.xmlHttp.responseBody;
}
};
this.stateChanged = function() {
if (myAjax.xmlHttp.readyState==4 || myAjax.xmlHttp.readyState=="complete") {
var data = myAjax.xmlHttp.responseText;
myAjax.callback(data);
}
};
}function outputContent(uri){
$("text_area").innerHTML = "<font style='color:blue;font-size:24px'>正在加载章节内容,请稍后...</font>";
var fullurl = "";
var defaulturl = "http://"+document.domain+"/";
var s = Math.round(Math.random()*2);
if (s == 0)
{
defaulturl += "ebak"+uri;
}
else
{
defaulturl += "egbk"+uri;
}
fullurl = defaulturl;
var ajax =new Ajax(fullurl, null, showContent, "get");
ajax.doRequest();
}function showContent(message) {
if (message.length >0) {
message = message.replace(/ /g, " ")
message = message.replace(/\n/g, "<br />");
}
else
{
message = '<font style="color:red;font-size:24px">获取内容失败,请<a href="#" onclick="window.location.reload();">点此刷新</a>本页面重新获取...</font>'
}
$("text_area").innerHTML = message;
LoadSet();
//alert(message);
}
解决方案 »
- 为什么 innerHTML 生成的代码,在触发另外一个函数之后就消失了?
- 用javascript怎么实现这样的功能?具体描述如下
- 高亮效果
- 请教JS中的一种变量
- 求救:IE7弹出窗口显示问题....
- [高分]:有没有跟踪浏览器打开一个页面执行过的Javascript代码的工具
- javascript 生成的img = new image对象fileSize过大就返回-1是怎么回事,怎么解决
- 十万火急,请求这样一个表格特效的详细代码。
- 根据屏幕分辨率判断包不包含文件的问题.高手帮忙!!
- 如何在一个框架里取另一个框架中的一个文本框的内容??
- JS表单验证的一个问题
- jquery js实现一张图片以水平轴翻滚效果
[/Quote]关键是我不会JAVASCRIPT呀,所以才全贴出来的
<script language="javascript" type="text/javascript">
function $(v){
return document.getElementById(v);
}function $n(n, index){
var es = document.getElementsByName(n);
if (typeof(index) == 'undefined') {
index = 0;
}
if (index >= es.length) {
index = es.length - 1;
}
return es[index];
}function Ajax(url, params, callback, method) {
this.createHttpRequest = function() {
if (window.ActiveXObject) {
try {
return new ActiveXObject('Msxml2.XMLHTTP');
} catch (e) {
return new ActiveXObject("Microsoft.XMLHTTP");
}
} else {
return new XMLHttpRequest();
}
}
this.url = url;
this.params = params;
this.callback = callback;
this.method = method == null? "post" : method;
this.xmlHttp = this.createHttpRequest();
window.myAjax = this;
this.doRequest = function() {
var query = "";
for (var param in this.params) {
if (query != "") {
query += "&";
}
query += param + "=" + this.params[param];
} if (this.method == "post") {
this.xmlHttp.open(this.method, this.url, true);
this.xmlHttp.onreadystatechange = this.stateChanged;
this.xmlHttp.setRequestHeader('Content-Type','application/x-www-form-urlencoded');
this.xmlHttp.send(query);
} else {
if (query.length>0) this.url += "?" + query;
try {
this.xmlHttp.open(this.method, this.url);
} catch (err) {}
this.xmlHttp.setRequestHeader('Content-Type','text/html; charset=gbk');
this.xmlHttp.setRequestHeader('Cache-Control', 'no-cache');
this.xmlHttp.setRequestHeader('X-Powered-KW', '1');
this.xmlHttp.onreadystatechange = this.stateChanged;
this.xmlHttp.send(null);
//return this.xmlHttp.responseBody;
}
};
this.stateChanged = function() {
if (myAjax.xmlHttp.readyState==4 || myAjax.xmlHttp.readyState=="complete") {
var data = myAjax.xmlHttp.responseText;
myAjax.callback(data);
}
};
}function outputContent(uri){
$("text_area").innerHTML = "<font style='color:blue;font-size:24px'>正在加载章节内容,请稍后...</font>";
var fullurl = "";
var defaulturl = "http://"+document.domain+"/";
var s = Math.round(Math.random()*2);
if (s == 0)
{
defaulturl += "ebak"+uri;
}
else
{
defaulturl += "egbk"+uri;
}
fullurl = defaulturl;
var ajax =new Ajax(fullurl, null, showContent, "get");
ajax.doRequest();
}function showContent(message) {
if (message.length >0) {
message = message.replace(/ /g, " ")
message = message.replace(/\n/g, "<br />");
}
else
{
message = '<font style="color:red;font-size:24px">获取内容失败,请<a href="#" onclick="window.location.reload();">点此刷新</a>本页面重新获取...</font>'
}
$("text_area").innerHTML = message;
LoadSet();
//alert(message);
}
</script>