스크롤 광고 pptBox
9451 단어 ppt
/**
* PPT
* 2012-05-17
*/
function PPTBox()
{
this.uid = PPTBoxHelper.getId();
PPTBoxHelper.instance[this.uid] = this;
this._$ = function(id){return document.getElementById(id);};
this.width = 400;//
this.height = 300;//
this.picWidth = 15;//
this.picHeight = 12;//
this.autoplayer = 4;// ( )
this.target = "_blank";
this._box = [];
this._curIndex = 0;
}
PPTBox.prototype =
{
_createMainBox : function (){
var flashBoxWidth = this.width * this._box.length + 5;
var html="<div id='"+this.uid+"_mainbox' class='mainbox' style='width:"+(this.width)+"px;height:"+(this.height+2)+"px;'>";
html += "<div id='"+this.uid+"_flashbox' class='flashbox' style='width:"+flashBoxWidth+"px;height:"+(this.height+2)+"px;'></div>";
html += "<div id='"+this.uid+"_imagebox' class='imagebox' style='width:"+this.width+"px;height:"+(this.picHeight+2)+"px;top:-"+(this.picHeight+20)+"px;'></div>";
html += "</div>";
document.write(html);
},
_init : function (){
var picstyle= "";
var eventstr = "PPTBoxHelper.instance['"+this.uid+"']";
var imageHTML="";
var flashbox = "";
for(var i=0;i<this._box.length;i++){
var parame = this._box[i];
flashbox += this.flashHTML(parame.url,this.width,this.height,i);
imageHTML ="<div class='bitdiv "+((i==0)?"curimg":"defimg")+"' title ="+parame.title+" src='bit01.gif' "+picstyle+" onclick = \""+eventstr+".clickPic("+i+")\" onmouseover=\""+eventstr+".mouseoverPic("+i+")\"></div>" + imageHTML;
}
this._$(this.uid+"_flashbox").innerHTML = flashbox;
this._$(this.uid+"_imagebox").innerHTML = imageHTML;
},
_play : function(){
clearInterval(this._autoplay);
var idx = this._curIndex+1;
if(idx>=this._box.length){idx=0;}
this.changeIndex(idx);
var eventstr = "PPTBoxHelper.instance['"+this.uid+"']._play()";
this._autoplay = setInterval(eventstr,this.autoplayer*1000);
},
flashHTML : function(url,width,height,idx) {
var isFlash = url.substring(url.lastIndexOf('.')+1).toLowerCase()=="swf";
var html = "";
if(isFlash){
html = "<object classid='clsid:D27CDB6E-AE6D-11cf-96B8-444553540000' "
+ "codebase='http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=7,0,19,0' width='"+width+"' height='"+height+"'>"
+ "<param name=\"movie\" value=\""+url+"\" />"
+ "<param name='quality' value='high' />"
+ "<param name='wmode' value='transparent'>"
+ "<embed src='"+url+"' quality='high' wmode='opaque' pluginspage='http://www.macromedia.com/go/getflashplayer'"
+" type='application/x-shockwave-flash' width="+width+" height='"+height+"'></embed>"
+" </object>";
} else {
var eventstr = "PPTBoxHelper.instance['"+this.uid+"']";
var style = "";
if(this._box[idx].href){
style = "cursor:pointer"
}
html="<img src='"+url+"' style='width:"+width+"px;height:"+height+"px;"+style+"' onclick = \""+eventstr+".clickPic("+idx+")\"/>";
}
return html;
},
changeIndex : function(idx){
var parame = this._box[idx];
moveElement(this.uid+"_flashbox",-(idx*this.width),1);
var imgs = this._$(this.uid+"_imagebox").getElementsByTagName("div");
imgs[this._box.length-1-this._curIndex].className = "bitdiv defimg";
imgs[this._box.length-1-idx].className = "bitdiv curimg";
this._curIndex = idx;
},
mouseoverPic:function(idx){
this.changeIndex(idx);
if(this.autoplayer>0){
clearInterval(this._autoplay);
var eventstr = "PPTBoxHelper.instance['"+this.uid+"']._play()";
this._autoplay = setInterval(eventstr,this.autoplayer*1000);
}
},
clickPic:function(idx){
var parame = this._box[idx];
if(parame.href&¶me.href!=""){
window.open(parame.href,this.target);
}
},
add:function (imgParam){
this._box[this._box.length] = imgParam;
},
show : function () {
this._createMainBox();
this._init();
if(this.autoplayer>0){
var eventstr = "PPTBoxHelper.instance['"+this.uid+"']._play()";
this._autoplay = setInterval(eventstr,this.autoplayer*1000);
}
}
}
var PPTBoxHelper =
{
count: 0,
instance: {},
getId: function() { return '_ppt_box-' + (this.count++); }
};
function moveElement(elementID,final_x,interval) {
if (!document.getElementById) return false;
if (!document.getElementById(elementID)) return false;
var elem = document.getElementById(elementID);
if (elem.movement) {
clearTimeout(elem.movement);
}
if (!elem.style.left) {
elem.style.left = "0px";
}
var xpos = parseInt(elem.style.left);
if (xpos == final_x ) {
return true;
}
if (xpos < final_x) {
var dist = Math.ceil((final_x - xpos)/5);
xpos = xpos + dist;
}
if (xpos > final_x) {
var dist = Math.ceil((xpos - final_x)/5);
xpos = xpos - dist;
}
elem.style.left = xpos + "px";
var repeat = "moveElement('"+elementID+"',"+final_x+","+interval+")";
elem.movement = setTimeout(repeat,interval);
}
html
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=GBK" />
<link href="/shop/school/css/lrtk.css" rel="stylesheet" type="text/css" />
<title> 3G. . </title>
<script type="text/javascript" src="/shop/school/js/pptBox.js"></script>
</head>
<body>
<div>
<script>
var box =new PPTBox();
box.width = 960; //
box.height = 300;//
box.autoplayer = 8;//
//box.add({"url":" ","title":" ","href":" "})
box.add({"url":"/shop/school/imgs/focus/xm2.jpg","href":"/shop/ad/xm2/index.shtml","title":" 2"});
box.add({"url":"/shop/school/imgs/focus/cmb_mx.jpg","href":"/shop/ad/cmb_mx/index.shtml","title":" "});
box.add({"url":"/shop/school/imgs/focus/tjr.jpg","href":"/shop/html/cps/index.shtml","title":" "});
//box.add({"url":"/shop/school/imgs/focus/iphone5.jpg","href":"/shop/ad/iphone5/index.shtml","title":"iPhone5 "});
box.show();
</script>
</div>
</body>
</html>
이 내용에 흥미가 있습니까?
현재 기사가 여러분의 문제를 해결하지 못하는 경우 AI 엔진은 머신러닝 분석(스마트 모델이 방금 만들어져 부정확한 경우가 있을 수 있음)을 통해 가장 유사한 기사를 추천합니다:
java는 ppt 파일과poi를 사용하여 excel,word 예시를 읽습니다Apache의 POI 프로젝트는 MS Office 문서를 처리하는 데 사용할 수 있으며, codeplex에 그것의 것이 하나 더 있습니다.net 버전.POI 프로젝트는 OOXML 및 OLE2 파일 형식을 기반으로 하...
텍스트를 자유롭게 공유하거나 복사할 수 있습니다.하지만 이 문서의 URL은 참조 URL로 남겨 두십시오.
CC BY-SA 2.5, CC BY-SA 3.0 및 CC BY-SA 4.0에 따라 라이센스가 부여됩니다.