复制代码 代码如下:
var LF = {};
LF.version = '1.0.0';
//全局函数
function $(objName) {
return document.getElementById(objName);
}
function $name(objName) {
return document.getElementsByName(objName);
}
function $tag(objName) {
return document.getElementsByTagName(objName);
}
//广告swf flashWrite('SW/2009/HomeGroBuy.swf','950','70','navigation', '##ffffff', 'menuNum=0', 'transparent');
function flashWrite(url,w,h,id,bg,vars,win){
var flashStr=
"<div align=\"center\"><object classid='clsid:d27cdb6e-ae6d-11cf-96b8-444553540000' codebase='http://fpdownload.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=8,0,0,0' width='"+w+"' height='"+h+"' id='"+id+"' align='middle'>"+
"<param name='allowScriptAccess' value='always' />"+
"<param name='movie' value='"+url+"' />"+
"<param name='FlashVars' value='"+vars+"' />"+
"<param name='wmode' value='"+win+"' />"+
"<param name='menu' value='false' />"+
"<param name='quality' value='high' />"+
"<param name='bgcolor' value='"+bg+"' />"+
"<embed src='"+url+"' FlashVars='"+vars+"' wmode='"+win+"' menu='false' quality='high' bgcolor='"+bg+"' width='"+w+"' height='"+h+"' name='"+id+"' align='middle' allowScriptAccess='always' type='application/x-shockwave-flash' pluginspage='http://www.macromedia.com/go/getflashplayer' />"+
"</object></div>";
document.write(flashStr);
}
//广告图片 imgWrite('images/pic04.jpg', '780', '90', 'http://www.lfang.com/wzzt/2009/lgzt/');
function imgWrite(url,w,h,linkUrl){
var flashStr= "";
if (linkUrl=="")
flashStr="<img src=\""+url+"\" border=\"0\" width=\""+w+"\" height=\""+h+"\"/>";
else
flashStr="<a href=\""+linkUrl+"\">"+"<img src=\""+url+"\" border=\"0\" width=\""+w+"\" height=\""+h+"\"/>"+"</a>";
document.write(flashStr);
}
//AJAX操作
LF.ajax={
getXmlhttp : function() {
var http_request;
if(window.XMLHttpRequest) {
http_request = new XMLHttpRequest();
if (http_request.overrideMimeType) {
http_request.overrideMimeType("text/xml");
}
}
else if (window.ActiveXObject) {
try {
http_request = new ActiveXObject("Msxml2.XMLHTTP");
} catch (e) {
try {
http_request = new ActiveXObject("Microsoft.XMLHTTP");
} catch (e) {}
}
}
if (!http_request) {
window.alert("can't create XMLHttpRequest object.");
return null;
}
return http_request;
},
loadAJAXTab : function (url){// 一般是DIV
try {
var xhttp=LF.ajax.getXmlhttp();
xhttp.open("GET",url,false);
xhttp.send(null);
if (xhttp.readyState == 0)return "0初始化中......";
if (xhttp.readyState == 1)return "1初始化中......";
if (xhttp.readyState == 2)return "2初始化中......";
if (xhttp.readyState == 3)return "3初始化中......";
if(xhttp.readyState == 4 && (xhttp.status==200)){
var resText=xhttp.responseText;
if (resText!="")return resText;
}
}catch (e) {
return e;
}
},
dataSubmit:function(url,urlParameter,method){ //ajax post提交数据
try{
if(method==""){method="POST";}
var xhttp=LF.ajax.getXmlhttp();
xhttp.open(method, url+urlParameter, false);
xhttp.setRequestHeader("Content-Type","application/x-www-form-urlencoded");
xhttp.send(null);
if (xhttp.readyState == 0)return "0初始化中......";
if (xhttp.readyState == 1)return "1初始化中......";
if (xhttp.readyState == 2)return "2初始化中......";
if (xhttp.readyState == 3)return "3初始化中......";
if (xhttp.readyState == 4 && xhttp.status == 200)return xhttp.responseText;
}catch(e){
return e;
}
}
};
//工具
LF.util = {
setCookie:function (name,value){//写cookies
var Days = 30;
var exp = new Date();
exp.setTime(exp.getTime() + Days*24*60*60*1000);
document.cookie = name + "="+ escape (value) + ";expires=" + exp.toGMTString();
},
getCookie:function (name){//读取cookies
var arr,reg=new RegExp("(^| )"+name+"=([^;]*)(;|$)");
if(arr=document.cookie.match(reg)) return unescape(arr[2]);
else return null;
},
delCookie:function (name){//删除cookies
var exp = new Date();
exp.setTime(exp.getTime() - 1);
var cval=getCookie(name);
if(cval!=null) document.cookie= name + "="+cval+";expires="+exp.toGMTString();
},
escape:function (html) {//过滤html
html = html.replace(/&/g, "&");
html = html.replace(/</g, "<");
html = html.replace(/>/g, ">");
html = html.replace(/\xA0/g, " ");
html = html.replace(/\x20/g, " ");
return html;
}
};
var LF = {};
LF.version = '1.0.0';
//全局函数
function $(objName) {
return document.getElementById(objName);
}
function $name(objName) {
return document.getElementsByName(objName);
}
function $tag(objName) {
return document.getElementsByTagName(objName);
}
//广告swf flashWrite('SW/2009/HomeGroBuy.swf','950','70','navigation', '##ffffff', 'menuNum=0', 'transparent');
function flashWrite(url,w,h,id,bg,vars,win){
var flashStr=
"<div align=\"center\"><object classid='clsid:d27cdb6e-ae6d-11cf-96b8-444553540000' codebase='http://fpdownload.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=8,0,0,0' width='"+w+"' height='"+h+"' id='"+id+"' align='middle'>"+
"<param name='allowScriptAccess' value='always' />"+
"<param name='movie' value='"+url+"' />"+
"<param name='FlashVars' value='"+vars+"' />"+
"<param name='wmode' value='"+win+"' />"+
"<param name='menu' value='false' />"+
"<param name='quality' value='high' />"+
"<param name='bgcolor' value='"+bg+"' />"+
"<embed src='"+url+"' FlashVars='"+vars+"' wmode='"+win+"' menu='false' quality='high' bgcolor='"+bg+"' width='"+w+"' height='"+h+"' name='"+id+"' align='middle' allowScriptAccess='always' type='application/x-shockwave-flash' pluginspage='http://www.macromedia.com/go/getflashplayer' />"+
"</object></div>";
document.write(flashStr);
}
//广告图片 imgWrite('images/pic04.jpg', '780', '90', 'http://www.lfang.com/wzzt/2009/lgzt/');
function imgWrite(url,w,h,linkUrl){
var flashStr= "";
if (linkUrl=="")
flashStr="<img src=\""+url+"\" border=\"0\" width=\""+w+"\" height=\""+h+"\"/>";
else
flashStr="<a href=\""+linkUrl+"\">"+"<img src=\""+url+"\" border=\"0\" width=\""+w+"\" height=\""+h+"\"/>"+"</a>";
document.write(flashStr);
}
//AJAX操作
LF.ajax={
getXmlhttp : function() {
var http_request;
if(window.XMLHttpRequest) {
http_request = new XMLHttpRequest();
if (http_request.overrideMimeType) {
http_request.overrideMimeType("text/xml");
}
}
else if (window.ActiveXObject) {
try {
http_request = new ActiveXObject("Msxml2.XMLHTTP");
} catch (e) {
try {
http_request = new ActiveXObject("Microsoft.XMLHTTP");
} catch (e) {}
}
}
if (!http_request) {
window.alert("can't create XMLHttpRequest object.");
return null;
}
return http_request;
},
loadAJAXTab : function (url){// 一般是DIV
try {
var xhttp=LF.ajax.getXmlhttp();
xhttp.open("GET",url,false);
xhttp.send(null);
if (xhttp.readyState == 0)return "0初始化中......";
if (xhttp.readyState == 1)return "1初始化中......";
if (xhttp.readyState == 2)return "2初始化中......";
if (xhttp.readyState == 3)return "3初始化中......";
if(xhttp.readyState == 4 && (xhttp.status==200)){
var resText=xhttp.responseText;
if (resText!="")return resText;
}
}catch (e) {
return e;
}
},
dataSubmit:function(url,urlParameter,method){ //ajax post提交数据
try{
if(method==""){method="POST";}
var xhttp=LF.ajax.getXmlhttp();
xhttp.open(method, url+urlParameter, false);
xhttp.setRequestHeader("Content-Type","application/x-www-form-urlencoded");
xhttp.send(null);
if (xhttp.readyState == 0)return "0初始化中......";
if (xhttp.readyState == 1)return "1初始化中......";
if (xhttp.readyState == 2)return "2初始化中......";
if (xhttp.readyState == 3)return "3初始化中......";
if (xhttp.readyState == 4 && xhttp.status == 200)return xhttp.responseText;
}catch(e){
return e;
}
}
};
//工具
LF.util = {
setCookie:function (name,value){//写cookies
var Days = 30;
var exp = new Date();
exp.setTime(exp.getTime() + Days*24*60*60*1000);
document.cookie = name + "="+ escape (value) + ";expires=" + exp.toGMTString();
},
getCookie:function (name){//读取cookies
var arr,reg=new RegExp("(^| )"+name+"=([^;]*)(;|$)");
if(arr=document.cookie.match(reg)) return unescape(arr[2]);
else return null;
},
delCookie:function (name){//删除cookies
var exp = new Date();
exp.setTime(exp.getTime() - 1);
var cval=getCookie(name);
if(cval!=null) document.cookie= name + "="+cval+";expires="+exp.toGMTString();
},
escape:function (html) {//过滤html
html = html.replace(/&/g, "&");
html = html.replace(/</g, "<");
html = html.replace(/>/g, ">");
html = html.replace(/\xA0/g, " ");
html = html.replace(/\x20/g, " ");
return html;
}
};
标签:
JS,dom,ajax
免责声明:本站文章均来自网站采集或用户投稿,网站不提供任何软件下载或自行开发的软件!
如有用户或公司发现本站内容信息存在侵权行为,请邮件告知! 858582#qq.com
桃源资源网 Design By www.nqtax.com
暂无“JS获取dom 对象 ajax操作 读写cookie函数”评论...
RTX 5090要首发 性能要翻倍!三星展示GDDR7显存
三星在GTC上展示了专为下一代游戏GPU设计的GDDR7内存。
首次推出的GDDR7内存模块密度为16GB,每个模块容量为2GB。其速度预设为32 Gbps(PAM3),但也可以降至28 Gbps,以提高产量和初始阶段的整体性能和成本效益。
据三星表示,GDDR7内存的能效将提高20%,同时工作电压仅为1.1V,低于标准的1.2V。通过采用更新的封装材料和优化的电路设计,使得在高速运行时的发热量降低,GDDR7的热阻比GDDR6降低了70%。