// javascript document // description: sinputstring 为输入字符串,itype为类型,分别为 // 0 - 去除前后空格; 1 - 去前导空格; 2 - 去尾部空格 function trim(sinputstring) { itype=0; var stmpstr = ' ' var i = -1 if(itype == 0 || itype == 1) { while(stmpstr == ' ') { ++i stmpstr = sinputstring.substr(i,1) } sinputstring = sinputstring.substring(i) } if(itype == 0 || itype == 2) { stmpstr = ' ' i = sinputstring.length while(stmpstr == ' ') { --i stmpstr = sinputstring.substr(i,1) } sinputstring = sinputstring.substring(0,i+1) } return sinputstring } //格式化价钱 function formatprice(price) { //debugger; price=price+""; var l=price.indexof("."); if(l>=0) { if (price.substring(l + 1, 1) == "0") { return price.substring(0, l); } else { return math.round(price*10)/10; } } return price; } function setmargintop(){ mainid="div.mainpanel" var h=$(window).height(); var ph=$(mainid).height()/2; var pt=h/2 - ph; if(pt >=0) { $(mainid).css("margin-top",pt); } else { $(mainid).css("margin-top","0px"); } } function $get(id) { return document.getelementbyid(id); } //自动根据指定比例到指定容器控制图片的显示 function resetimgsize(divclass,wth,hgh) { var divcolection=document.getelementsbytagname("div");//获取div数组 //var divs=$get(divid); //debugger; for(j=0;jsetheight||width>setwidth) { if(width/height>setwidth/setheight) { height=setwidth*height/width width=setwidth; } else { width=setheight*width/height height=setheight; } } imgs[i].height=height; if(heightsize) { $(this).width(size); //alert($(this)) $(this).attr("rel","lytebox"); $(this).removeattr("height"); } break; case 2: if($(this).height()>size) { $(this).height(size); //alert($(this)) $(this).attr("rel","lytebox"); $(this).removeattr("width"); } break; } } ); } //添加flash轮播广告 width长,height高,pics图片,links链接,texts文字 function addflash1(width,height,pics,links,texts) { var pic_width=width; //图片宽度//this param387 var pic_height=height; //图片高度//this param244 var button_pos=4; //按扭位置 1左 2右 3上 4下//this param var stop_time=10000; //图片停留时间(1000为1秒钟)//this param var show_text=0; //是否显示文字标签 1显示 0不显示//this param var txtcolor="000000"; //文字色 var bgcolor="dddddd"; //背景色 var imag=new array(); var link=new array();//this param var text=new array();//this param //可编辑内容结束 var swf_height=show_text==0?pic_height:pic_height;//this param var pics=pics; var links=links; var texts=texts; var wmode = 'movie'; var flashurl = 'focus.swf'; var htmlstr = ''; document.write(htmlstr); } function addflash2(width,height,pics,links,texts) { var focus_width=width; var focus_height=height; var text_height=0; var swf_height = focus_height+text_height; var src="playswfnew.swf"; document.write(''); document.write(''); document.write(''); document.write(''); document.write(''); document.write(''); } //添加普通flash function addflash(width,height,src) { var htmlstr = ''; document.write(htmlstr); }// javascript document function addflash3(width,height,pics,links,texts) { var focus_width=width var focus_height=height var text_height=0 var swf_height = focus_height+text_height var pics=pics var links=links var texts=texts document.write(''); document.write(' '); document.write(''); document.write(''); document.write(''); document.write(''); } function addflashad(widht,count) { var $ = function (id) { return "string" == typeof id ? document.getelementbyid(id) : id; }; var class = { create: function() { return function() { this.initialize.apply(this, arguments); } } } object.extend = function(destination, source) { for (var property in source) { destination[property] = source[property]; } return destination; } var transformview = class.create(); transformview.prototype = { //容器对象,滑动对象,切换参数,切换数量 initialize: function(container, slider, parameter, count, options) { if(parameter <= 0 || count <= 0) return; var ocontainer = $(container), oslider = $(slider), othis = this; this.index = 0;//当前索引 this._timer = null;//定时器 this._slider = oslider;//滑动对象 this._parameter = parameter;//切换参数 this._count = count || 0;//切换数量 this._target = 0;//目标参数 this.setoptions(options); this.up = !!this.options.up; this.step = math.abs(this.options.step); this.time = math.abs(this.options.time); this.auto = !!this.options.auto; this.pause = math.abs(this.options.pause); this.onstart = this.options.onstart; this.onfinish = this.options.onfinish; ocontainer.style.overflow = "hidden"; ocontainer.style.position = "relative"; oslider.style.position = "absolute"; oslider.style.top = oslider.style.left = 0; }, //设置默认属性 setoptions: function(options) { this.options = {//默认值 up: true,//是否向上(否则向左) step: 5,//滑动变化率 time: 10,//滑动延时 auto: true,//是否自动转换 pause: 2000,//停顿时间(auto为true时有效) onstart: function(){},//开始转换时执行 onfinish: function(){}//完成转换时执行 }; object.extend(this.options, options || {}); }, //开始切换设置 start: function() { if(this.index < 0){ this.index = this._count - 1; } else if (this.index >= this._count){ this.index = 0; } this._target = -1 * this._parameter * this.index; this.onstart(); this.move(); }, //移动 move: function() { cleartimeout(this._timer); var othis = this, style = this.up ? "top" : "left", inow = parseint(this._slider.style[style]) || 0, istep = this.getstep(this._target, inow); if (istep != 0) { this._slider.style[style] = (inow + istep) + "px"; this._timer = settimeout(function(){ othis.move(); }, this.time); } else { this._slider.style[style] = this._target + "px"; this.onfinish(); if (this.auto) { this._timer = settimeout(function(){ othis.index++; othis.start(); }, this.pause); } } }, //获取步长 getstep: function(itarget, inow) { var istep = (itarget - inow) / this.step; if (istep == 0) return 0; if (math.abs(istep) < 1) return (istep > 0 ? 1 : -1); return istep; }, //停止 stop: function(itarget, inow) { cleartimeout(this._timer); this._slider.style[this.up ? "top" : "left"] = this._target + "px"; } }; window.onload=function(){ function each(list, fun){ for (var i = 0, len = list.length; i < len; i++) { fun(list[i], i); } }; var objs2 = $("idnum2").getelementsbytagname("li"); var tv2 = new transformview("idtransformview2", "idslider2", widht, count, { onstart: function(){ each(objs2, function(o, i){ o.classname = tv2.index == i ? "on" : ""; }) },//按钮样式 up: false }); tv2.start(); each(objs2, function(o, i){ o.onmouseover = function(){ o.classname = "on"; tv2.auto = false; tv2.index = i; tv2.start(); } o.onmouseout = function(){ o.classname = ""; tv2.auto = true; tv2.start(); } }) } } function doselectall() { var i=0; var idstr=""; var obj=document.getelementbyid("selectall"); for(i=0;i function addtofavorite() { if (document.all){ window.external.addfavorite(document.url,document.title); }else if (window.sidebar){ window.sidebar.addpanel(document.title, document.url, ""); } } //取当前时间,格式为,yyyy-mm-dd hh:mm:ss function getnowformatdate() { var day = new date(); var year = 0; var month = 0; var day = 0; var currentdate = ""; //初始化时间 //year= day.getyear();//有火狐下2008年显示108的bug year= day.getfullyear();//ie火狐下都可以 month= day.getmonth()+1; day = day.getdate(); hour = day.gethours(); minute = day.getminutes(); second = day.getseconds(); currentdate += year + "-"; if (month >= 10 ) { currentdate += month + "-"; } else { currentdate += "0" + month + "-"; } if (day >= 10 ) { currentdate += day ; } else { currentdate += "0" + day ; } if(hour>=10) { currentdate+=" "+hour; }else { currentdate+=" 0"+hour; } if(minute>=10) { currentdate+=":"+minute; }else { currentdate+=":0"+minute; } if(second>=10) { currentdate+=":"+second; } else { currentdate+=":0"+second; } return currentdate; } //播放视频 function writevideo(src,w,h) { var vtype= src.split("."); videotype=vtype[1]; var videcode=''; switch(videotype) { case "flv": videcode+=''; videcode+=''; videcode+=''; videcode+=''; videcode+=''; videcode+=''; videcode+=''; break; } document.writeln(videcode); } //获取随机数 function getrandomnum(minnum,maxnum) { var rand = math.random(); return rand*(maxnum-minnum)+minnum; }