PCDVD數位科技討論區

PCDVD數位科技討論區 (https://www.pcdvd.com.tw/index.php)
-   疑難雜症區 (https://www.pcdvd.com.tw/forumdisplay.php?f=34)
-   -   請問關於 Html 的"連結圖檔"自動移動頁面中間語法! (https://www.pcdvd.com.tw/showthread.php?t=379946)

gimmyyu 2004-09-04 05:39 PM

請問關於 Html 的"連結圖檔"自動移動頁面中間語法!
 
請問這頁面裡的 『↑Top』圖檔 ,都會自動移至頁面中央,請問這是用何語法?
語法該置放於原始檔的哪裡?
謝謝

mpc 2004-09-04 05:44 PM

引用:
作者gimmyyu
請問這頁面裡的 『↑Top』圖檔 (http:///t-link.bestshop.com.tw/main/search.asp?k=2481) ,都會自動移至頁面中央,請問這是用何語法?
語法該置放於原始檔的哪裡?
謝謝


看不到網頁.....

您所說的應該是"書籤"功能
按下後會跑到原本設定時的位置

gimmyyu 2004-09-04 05:58 PM

引用:
作者mpc
看不到網頁.....

您所說的應該是"書籤"功能
按下後會跑到原本設定時的位置


抱歉!
上篇的連結多打了個 " /" 造成連結錯誤!

他是有用到書籤功能沒錯!
我是想問他 "↑Top 圖檔"會跟著卷軸跑到『頁面左邊中央』
這是如何做出來的?

範例網頁

mpc 2004-09-04 06:04 PM

引用:
作者gimmyyu
抱歉!
上篇的連結多打了個 " /" 造成連結錯誤!

他是有用到書籤功能沒錯!
我是想問他 "↑Top 圖檔"會跟著卷軸跑到『頁面左邊中央』
這是如何做出來的?

範例網頁 (http://t-link.bestshop.com.tw/main/search.asp?k=2481)


Javascript
滿簡單的
你把這段貼上就有,不過圖檔的路徑要自己修改



</script><script language="Javascript">
<!-- Begin
window.onerror = null;
var topMargin = 350;// 上面定位距離
var sTime = 1200;
var ns6 = (!document.all && document.getElementById);
var ie4 = (document.all);
var ns4 = (document.layers);
function showlay1(id,left) {
if (ns6) {
this.obj = document.getElementById(id).style;
this.obj.left = left;
return this.obj;
}
else if(ie4) {
this.obj = document.all[id].style;
this.obj.left = left;
return this.obj;
}
else if(ns4) {
this.obj = document.layers[id];
this.obj.left = left;
return this.obj;
}
}
function showlay2() {
showLyr = new showlay1('floatLayer', pageWidth);//

window.setInterval("showmain()", 10)
}
function showlay3() {
if (ns4 || ns6) {
findHt = window.innerHeight;
} else if(ie4) {
findHt = document.body.clientHeight;
}
}
function showmain() {
if (ns4) {
this.currentY = document.layers["floatLayer"].top;
this.scrollTop = window.pageYOffset;
main1();
}
else if(ns6) {
this.currentY = parseInt(document.getElementById('floatLayer').style.top);
this.scrollTop = scrollY;
main1();
} else if(ie4) {
this.currentY = floatLayer.style.pixelTop;
this.scrollTop = document.body.scrollTop;
main1();
}
}
function main1() {
var newT = this.scrollTop + this.topMargin;
if ( this.currentY != newT ) {
if ( newT != this.targetY ) {
this.targetY = newT;
showStart();
}
showgo();
}
}
function showStart() {
var now = new Date();
this.A = this.targetY - this.currentY;
this.B = Math.PI / ( 2 * this.sTime );
this.C = now.getTime();
if (Math.abs(this.A) > this.findHt) {
this.D = this.A > 0 ? this.targetY - this.findHt : this.targetY + this.findHt;
this.A = this.A > 0 ? this.findHt : -this.findHt;
}
else {
this.D = this.currentY;
}
}
function showgo() {
var now = new Date();
var newY = this.A * Math.sin( this.B * ( now.getTime() - this.C ) ) + this.D;
newY = Math.round(newY);
if (( this.A > 0 && newY > this.currentY ) || ( this.A < 0 && newY < this.currentY )) {
if ( ie4 )document.all.floatLayer.style.pixelTop = newY;
if ( ns4 )document.layers["floatLayer"].top = newY;
if ( ns6 )document.getElementById('floatLayer').style.top = newY + "px";
}
}
function startnow() {
if(ns6||ns4) {
pageWidth = (innerWidth /2) + 350;
pageHeight = innerHeight;
showlay2();
showlay3();
}
else if(ie4) {
pageWidth = document.body.clientWidth/2 + 350;
pageHeight = document.body.clientHeight;
showlay2();
showlay3();
}
}
// End -->

<!--

//
var flash_w = 80;
if(navigator.appVersion.charAt(0)>='4') {
if(navigator.appName.indexOf("Netscape")==-1){
document.write('<div id="floatLayer" style="position:absolute; left: 820px; top: 150px; width: 31px; height: 11px; Z-INDEX: 100">');
document.write('<a href="#top"><img src="../images/top.gif" border="0" alt="本頁頂端"></a>');
document.write('</div>');
}
else {
document.write('<layer id="floatLayer" position="absolute" left=820 top=150 width=31 height="11">');
document.write('<a href="#top"><img src="../images/top.gif" border="0" alt="本頁頂端"></a>');
document.write('</layer>');
}
}
//
startnow();
//-->
</script>


所有的時間均為GMT +8。 現在的時間是01:43 AM.

vBulletin Version 3.0.1
powered_by_vbulletin 2026。