查看完整版本: 設定圖片顯示位置

17-5-2012 10:24

設定圖片顯示位置

<P><FONT color=#0000ff size=3>如不能顯示語法效果可貼去本站</FONT><A href="http://www.bunbun000.com/html/index.htm" target=_blank><FONT color=red size=3>語法測試板</FONT></A><FONT color=#0000ff size=3>試看</FONT></P>
<P>&nbsp;</P>
<P>&nbsp;</P>
<P><A href="http://bunbun000.com/home/index/BBS.gif"><FONT color=purple>http://bunbun000.com/home/index/BBS.gif</FONT></A><FONT color=purple>&nbsp; &lt;&lt;&lt;圖片網址</FONT></P>
<P><FONT color=#800080></FONT>&nbsp;</P>
<P><A href="http://bunbun000.com/home/index/BBS.gif"><FONT color=purple>http://bunbun000.com/</FONT></A><FONT color=purple>&nbsp;&lt;&lt;&lt;圖片連結位置</FONT></P>
<P><FONT color=purple></FONT>&nbsp;</P>
<P><FONT color=purple>&nbsp;alt="笨笨網站"&nbsp; &lt;&lt;&lt;指著圖片時顯示語句</FONT></P>
<P><FONT color=purple></FONT>&nbsp;</P>
<P><FONT color=purple>var dx=88,dy=31;&nbsp; &lt;&lt;&lt;圖片實際大小</FONT></P>
<P><FONT color=purple></FONT>&nbsp;</P>
<P><FONT color=purple>var choose=4;&nbsp; &lt;&lt;&lt;&lt; 4為圖片出現之位置</FONT></P>
<P><FONT color=purple></FONT>&nbsp;</P>
<P><FONT color=purple>1 顯示在右上角<BR>2 顯示在左上角<BR>3 顯示在左下角<BR>4 顯示在右下角</FONT><BR></P>
<P><FONT color=blue></FONT>&nbsp;</P>
<P><FONT color=blue></FONT>&nbsp;</P>
<P><FONT color=blue></FONT>&nbsp;</P>
<P><FONT color=blue></FONT>&nbsp;</P>
<P><FONT color=blue>&lt;div id="mark" style="POSITION: absolute; VISIBILITY: visible&nbsp; ; Z-INDEX: 2000; top: -500px; left:0px;"&gt;<BR>&lt;A href="</FONT><A href="http://bunbun000.com/home/index/BBS.gif"><FONT color=blue>http://bunbun000.com/</FONT></A><FONT color=blue>" target="_blank"&gt;<BR>&lt;IMG img border="0" src="</FONT><A href="http://bunbun000.com/home/index/BBS.gif"><FONT color=blue>http://bunbun000.com/home/index/BBS.gif</FONT></A><FONT color=blue>" alt="笨笨網站"&gt;&lt;/A&gt;<BR>&lt;/div&gt;</FONT></P>
<P><BR><FONT color=blue>&lt;script language="javascript1.2"&gt;</FONT></P>
<P><FONT color=blue>var dx=88,dy=31;<BR>var choose=4;</FONT></P>
<P><FONT color=blue>var bWidth,bHeight,offsetX,offsetY;<BR>var layerRef="null",layerStyleRef="null",styleSwitch="null";</FONT></P>
<P><FONT color=blue>if (document.layers) {<BR>&nbsp;layerStyleRef="layer.";<BR>&nbsp;layerRef="document.layers";<BR>&nbsp;styleSwitch="";<BR>&nbsp;pxSwitch="";</FONT></P>
<P><FONT color=blue>&nbsp;bHeight=window.innerHeight;<BR>&nbsp;bWidth= window.innerWidth;<BR>&nbsp;offsetX= "window.pageXOffset";<BR>&nbsp;offsetY=" window.pageYOffset";<BR>}<BR>else{<BR>&nbsp;layerStyleRef="layer.style.";<BR>&nbsp;layerRef="document.all";<BR>&nbsp;styleSwitch=".style";</FONT></P>
<P><FONT color=blue>&nbsp;bHeight=document.body.clientHeight;<BR>&nbsp;bWidth= document.body.clientWidth;<BR>&nbsp;offsetX= "document.body.scrollLeft";<BR>&nbsp;offsetY= "document.body.scrollTop";<BR>}</FONT></P>
<P><FONT color=blue>function moveLayerto(layerName,top,left){<BR>&nbsp;eval(layerRef+'["'+layerName+'"]'+styleSwitch+'.top=top');<BR>&nbsp;eval(layerRef+'["'+layerName+'"]'+styleSwitch+'.left=left');<BR>}</FONT></P>
<P><FONT color=blue>function alwaysONup(){<BR>&nbsp;var newY;<BR>&nbsp;if(choose == 1) {<BR>&nbsp;&nbsp;layer_y = 0;<BR>&nbsp;&nbsp;layer_x = bWidth;<BR>&nbsp;&nbsp;layer_x += -dx;<BR>&nbsp;}<BR>&nbsp;else if(choose == 2) {<BR>&nbsp;&nbsp;layer_y = 0;<BR>&nbsp;&nbsp;layer_x = 0;<BR>&nbsp;}<BR>&nbsp;else if(choose == 3) {<BR>&nbsp;&nbsp;layer_y = bHeight;<BR>&nbsp;&nbsp;layer_y += -dy;<BR>&nbsp;&nbsp;layer_x = 0;<BR>&nbsp;}<BR>&nbsp;else if(choose == 4) {<BR>&nbsp;&nbsp;layer_y = bHeight;<BR>&nbsp;&nbsp;layer_y += -dy;<BR>&nbsp;&nbsp;layer_x = bWidth;<BR>&nbsp;&nbsp;layer_x += -dx;<BR>&nbsp;}<BR>&nbsp;else {<BR>&nbsp;&nbsp;alert("所輸入不正確!")<BR>&nbsp;}<BR>&nbsp;eval('layer_y+='+offsetY);<BR>&nbsp;moveLayerto("mark",layer_y,layer_x);<BR>&nbsp;setInterval('alwaysONup()');<BR>}</FONT></P>
<P><FONT color=blue>window.onLoad=alwaysONup();</FONT></P>
<P><FONT color=blue>&lt;/script&gt;</FONT></P>

25-5-2013 12:21

複製上列語法

<form name="copy">
<textarea cols="40" name="txt" rows="4" style="BACKGROUND-COLOR:#ffffff; COLOR:#000000; FONT-SIZE:9pt">
<div id="mark" style="POSITION: absolute; VISIBILITY: visible  ; Z-INDEX: 2000; top: -500px; left:0px;">
<A href="http://bunbun000.com/" target="_blank">
<IMG img border="0" src="http://bunbun000.com/home/index/BBS.gif" alt="笨笨網站"></A>
</div>


<script language="javascript1.2">

var dx=88,dy=31;
var choose=4;

var bWidth,bHeight,offsetX,offsetY;
var layerRef="null",layerStyleRef="null",styleSwitch="null";

if (document.layers) {
layerStyleRef="layer.";
layerRef="document.layers";
styleSwitch="";
pxSwitch="";

bHeight=window.innerHeight;
bWidth= window.innerWidth;
offsetX= "window.pageXOffset";
offsetY=" window.pageYOffset";
}
else{
layerStyleRef="layer.style.";
layerRef="document.all";
styleSwitch=".style";

bHeight=document.body.clientHeight;
bWidth= document.body.clientWidth;
offsetX= "document.body.scrollLeft";
offsetY= "document.body.scrollTop";
}

function moveLayerto(layerName,top,left){
eval(layerRef+'["'+layerName+'"]'+styleSwitch+'.top=top');
eval(layerRef+'["'+layerName+'"]'+styleSwitch+'.left=left');
}

function alwaysONup(){
var newY;
if(choose == 1) {
  layer_y = 0;
  layer_x = bWidth;
  layer_x += -dx;
}
else if(choose == 2) {
  layer_y = 0;
  layer_x = 0;
}
else if(choose == 3) {
  layer_y = bHeight;
  layer_y += -dy;
  layer_x = 0;
}
else if(choose == 4) {
  layer_y = bHeight;
  layer_y += -dy;
  layer_x = bWidth;
  layer_x += -dx;
}
else {
  alert("所輸入不正確!")
}
eval('layer_y+='+offsetY);
moveLayerto("mark",layer_y,layer_x);
setInterval('alwaysONup()');
}

window.onLoad=alwaysONup();

</script>
</textarea><br>
<input onclick="javascript:this.form.txt.focus();this.form.txt.select();" type="button" value="全選">
</form>

<br>

<script type="text/javascript"><!--
google_ad_client = "ca-pub-4078143172638881";
/* 336X280 */
google_ad_slot = "3268225205";
google_ad_width = 336;
google_ad_height = 280;
//-->
</script>
<script type="text/javascript"
src="http://pagead2.googlesyndication.com/pagead/show_ads.js">
</script>
頁: [1]
查看完整版本: 設定圖片顯示位置