- function loadJS2(_jsFile,id){
- var oJS = document.getElementById(id);
- if (oJS!= null && oJS.tagName.toLowerCase()== "script" )
- document.getElementsByTagName( "head" ).item(0).removeChild(oJS);
- oJS = document.createElement( 'script' );
- oJS.setAttribute( "language" , "JavaScript" );
- //oJS.setAttribute("charset","utf-8");
- oJS.setAttribute( "id" ,id);
- oJS.setAttribute( "src" , _jsFile);
- document.getElementsByTagName( "head" ).item(0).appendChild(oJS);
- }
- //动态调整图片大小
- function resizeImg(obj) {
- var new_w = new_h = 0;
- var img = new Image();
- img.src = obj.src;
- if (img.width>0) {
- ori_w = img.width;
- ori_h = img.height;
- }
- //预设宽和高 度
- area_w = 130;
- area_h = 98;
- if (ori_w>ori_h) {
- new_w = ori_w>area_w?area_w:ori_w;
- new_h = parseInt(ori_h*new_w/ori_w);
- if (new_h>area_h) {
- new_h = area_h;
- new_w = parseInt(ori_w*new_h/ori_h);
- }
- obj.zoomsize = new_w/ori_w *100;
- } else {
- new_h = ori_h>area_h?area_h:ori_h;
- new_w = parseInt(ori_w*new_h/ori_h);
- if (new_w>area_w) {
- new_w = area_w;
- new_h = parseInt(ori_h*new_w/ori_w);
- }
- }
- //alert(ori_w+"x" + ori_h + "->" + new_w+"x" + new_h);
- if (obj) {
- obj.style.width = new_w+ "px" ;
- obj.style.height = new_h+ "px" ;
- }
- return {width: new_w, height: new_h, roomsize: obj.roomsize};
- }