PCDVD數位科技討論區
PCDVD數位科技討論區   註冊 常見問題 標記討論區為已讀

回到   PCDVD數位科技討論區 > 其他群組 > 疑難雜症區
帳戶
密碼
 

回應
 
主題工具
gimmyyu
Junior Member
 

加入日期: Apr 2002
文章: 745
Question 請問關於 Html 的"連結圖檔"自動移動頁面中間語法!

請問這頁面裡的 『↑Top』圖檔 ,都會自動移至頁面中央,請問這是用何語法?
語法該置放於原始檔的哪裡?
謝謝
     
      
舊 2004-09-04, 05:39 PM #1
回應時引用此文章
gimmyyu離線中  
mpc
Golden Member
 
mpc的大頭照
 

加入日期: Sep 2001
您的住址: =風鈴草文具店=
文章: 3,186
引用:
作者gimmyyu
請問這頁面裡的 『↑Top』圖檔 (http:///t-link.bestshop.com.tw/main/search.asp?k=2481) ,都會自動移至頁面中央,請問這是用何語法?
語法該置放於原始檔的哪裡?
謝謝


看不到網頁.....

您所說的應該是"書籤"功能
按下後會跑到原本設定時的位置
 
舊 2004-09-04, 05:44 PM #2
回應時引用此文章
mpc離線中  
gimmyyu
Junior Member
 

加入日期: Apr 2002
文章: 745
引用:
作者mpc
看不到網頁.....

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


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

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

範例網頁

此文章於 2004-09-04 06:01 PM 被 gimmyyu 編輯.
舊 2004-09-04, 05:58 PM #3
回應時引用此文章
gimmyyu離線中  
mpc
Golden Member
 
mpc的大頭照
 

加入日期: Sep 2001
您的住址: =風鈴草文具店=
文章: 3,186
引用:
作者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>

此文章於 2004-09-04 06:05 PM 被 mpc 編輯.
舊 2004-09-04, 06:04 PM #4
回應時引用此文章
mpc離線中  


回應


POPIN
主題工具

發表文章規則
不可以發起新主題
不可以回應主題
不可以上傳附加檔案
不可以編輯您的文章

vB 代碼打開
[IMG]代碼打開
HTML代碼關閉



所有的時間均為GMT +8。 現在的時間是08:49 PM.


vBulletin Version 3.0.1
powered_by_vbulletin 2026。