js代码:
//初始化回到顶部控件
function initReturnTopDiv(type){
var sHeight = 10;
switch(type){
case 'top':
sHeight = 10;
break;
case 'center':
sHeight = screen.availHeight/2-80;
break;
case 'bottom':
sHeight = document.body.clientHeight - 25;
break;
}
var imgSrc = '/resource/image/returnTop.gif';
var htmlStr = '<DIV style="BORDER-RIGHT: medium none; BORDER-TOP: medium none; '
+ ' RIGHT: expression(eval(document.body.scrollLeft)+20); FILTER: progid:DXImageTransform.Microsoftpadding:8px; BORDER-LEFT: medium none; '
+ ' BORDER-BOTTOM: medium none; POSITION: absolute; '
+ ' TOP: expression(eval(document.body.scrollTop)+'+sHeight+'); TEXT-ALIGN: center">'
+ ' <img src="'+imgSrc+'" οnmοusedοwn="window.scrollTo(0,0);" style="cursor:hand;" title="返回顶部"/>'
+ '</DIV>';
document.body.insertAdjacentHTML('beforeEnd', htmlStr);//往html页面尾部插入代码
}