<?xml version="1.0" encoding="UTF-8" ?>
<rss version="2.0">
<channel>
<title><![CDATA[A.PAO designSTUDIO BLOG]]></title> 
<link>https://blog.apao.idv.tw/index.php</link> 
<description><![CDATA[A.PAO designSTUDIO 阿保工作室]]></description> 
<language>zh-tw</language> 
<copyright><![CDATA[A.PAO designSTUDIO BLOG]]></copyright>
<item>
<link>https://blog.apao.idv.tw/post/1294/</link>
<title><![CDATA[點擊 input 文字框內之預設文字時就移除預設文字的方法]]></title> 
<author>apao &lt;apao@www.apao.idv.tw&gt;</author>
<category><![CDATA[JavaScript]]></category>
<pubDate>Tue, 28 May 2019 06:04:16 +0000</pubDate> 
<guid>https://blog.apao.idv.tw/post/1294/</guid> 
<description>
<![CDATA[ 
	<span style="font-size: 120%;"><strong>▼加在一般 html 方法，以下的「輸入內容」要同時輸入兩邊。</strong></span><br/>說明：使用onfocus 事件，檢查value的內容，如果是初始內容，就將內容清空<br/><div class="code">&lt;input type=&quot;text&quot; value=&quot;輸入內容&quot; onfocus=&quot;javascript:if(this.value==&#039;輸入內容&#039;)this.value=&#039;&#039;;&quot;&gt;</div><br/>▼DEMO try it：<br/><div class="bDemoMe"><form action="#" method="get"><br/>&nbsp;&nbsp;<input type="text" value="輸入內容" onfocus="javascript:if(this.value=='輸入內容')this.value='';"><br/>&nbsp;&nbsp;<button type="button">送出內容</button><br/></form></div><br/><br/><span style="font-size: 120%;"><strong>▼加在HTML5 的方法</strong></span><br/>說明：輸入文字時，預設文字才會消失。<br/><div class="code">&lt;input id=&quot;email&quot; type=&quot;text&quot; placeholder=&quot;輸入內容&quot; size=&quot;22&quot; /&gt;</div><br/>▼DEMO try it：<br/><div class="bDemoMe"><form action="#" method="get"><br/>&nbsp;&nbsp;<input type="search" name="user_search" placeholder="輸入內容" /><br/>&nbsp;&nbsp;<button type="button">送出內容</button><br/></form></div><br/>Tags - <a href="https://blog.apao.idv.tw/tags/%25E9%25BB%259E%25E6%2593%258A/" rel="tag">點擊</a> , <a href="https://blog.apao.idv.tw/tags/input/" rel="tag">input</a> , <a href="https://blog.apao.idv.tw/tags/%25E6%2596%2587%25E5%25AD%2597%25E6%25A1%2586/" rel="tag">文字框</a> , <a href="https://blog.apao.idv.tw/tags/%25E9%25A0%2590%25E8%25A8%25AD/" rel="tag">預設</a> , <a href="https://blog.apao.idv.tw/tags/%25E7%25A7%25BB%25E9%2599%25A4%25E9%25A0%2590%25E8%25A8%25AD/" rel="tag">移除預設</a>
]]>
</description>
</item><item>
<link>https://blog.apao.idv.tw/post/1106/</link>
<title><![CDATA[Radio 選擇時 隱藏或是秀出 區塊 ]]></title> 
<author>apao &lt;apao@www.apao.idv.tw&gt;</author>
<category><![CDATA[JavaScript]]></category>
<pubDate>Sun, 12 Apr 2015 12:07:43 +0000</pubDate> 
<guid>https://blog.apao.idv.tw/post/1106/</guid> 
<description>
<![CDATA[ 
	<a href="https://blog.apao.idv.tw/attachment.php?fid=2150" target="_blank"><img src="https://blog.apao.idv.tw/attachment.php?fid=2150" class="insertimage" alt="點擊在新視窗中瀏覽此圖片" title="點擊在新視窗中瀏覽此圖片" border="0" width="540"/></a><br/>同時秀出價格<br/><br/><a href="https://blog.apao.idv.tw/attachment.php?fid=2151" target="_blank"><img src="https://blog.apao.idv.tw/attachment.php?fid=2151" class="insertimage" alt="點擊在新視窗中瀏覽此圖片" title="點擊在新視窗中瀏覽此圖片" border="0" width="540"/></a><br/>同時秀出價格<br/><br/><span style="font-size: 130%;">CSS (head)</span><br/><div class="code">/*隱藏區塊用*/<br/>.box&#123;display: none;&#125;<br/>/*秀出區塊用*/<br/>.bS01&#123;&#125;<br/>.bS02&#123;&#125;<br/>.bS03&#123;&#125;<br/>/*區塊範圍指定*/<br/>.bBW&#123;&#125;<br/></div><br/><br/><span style="font-size: 130%;">JavaScript (head)</span><br/><div class="code">&lt;script type=&quot;text/javascript&quot; src=&quot;http://code.jquery.com/jquery.min.js&quot;&gt;&lt;/script&gt;<br/>&lt;script type=&quot;text/javascript&quot;&gt;<br/>$(document).ready(function()&#123;<br/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;$(&#039;input&#91;type=&quot;radio&quot;&#93;&#039;).click(function()&#123;<br/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;if($(this).attr(&quot;value&quot;)==&quot;bOne&quot;)&#123;<br/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;$(&quot;.box&quot;).hide();<br/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;$(&quot;.bS01&quot;).show();<br/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&#125;<br/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;if($(this).attr(&quot;value&quot;)==&quot;bTwo&quot;)&#123;<br/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;$(&quot;.box&quot;).hide();<br/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;$(&quot;.bS02&quot;).show();<br/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&#125;<br/><br/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&#125;);<br/>&nbsp;&nbsp;&nbsp;&nbsp;&#125;);<br/>&lt;/script&gt;</div><br/><br/><span style="font-size: 130%;">HTML Code (body)</span><br/><br/><input name="Paytype" type="radio" value="bOne" checked="checked">信用卡 / ATM<br/><input name="Paytype" type="radio" value="bTwo">貨到付款<br/><br/><div class="code">&lt;input name=&quot;Paytype&quot; type=&quot;radio&quot; value=&quot;bOne&quot; checked=&quot;checked&quot;&gt;信用卡 / ATM<br/>&lt;input name=&quot;Paytype&quot; type=&quot;radio&quot; value=&quot;bTwo&quot;&gt;貨到付款<br/><br/>&lt;!-- 如果開始要顯示要加入 style=&quot;display:block;&quot; 不顯示則加入&nbsp;&nbsp;style=&quot;display:none;&quot;--&gt;<br/>&lt;div class=&quot;bS01 box bBW&quot; style=&quot;display:block;&quot;&gt;線上刷卡機制將客戶直接連結到各「銀行網路信用卡機制」，當客戶在本公司平台刷卡時，本公司及其它任何人均無法取得客戶信用卡資料。同時本公司平台網路安全受網際威信SSL安全機制的嚴格保護。將資料作複雜的運算及編碼，讓客戶安心地自由的瀏覽並付費，而無後顧之憂。&lt;br&gt;<br/>我們的線上付款方式有以下機制: &lt;br&gt;<br/>一.信用卡(限&lt;font color=&quot;#FF0000&quot;&gt;NT100元&lt;/font&gt;以上): Visa、 Master、JCB、U卡、America Express<br/>&lt;br&gt;<br/>二.銀行晶片卡線上轉帳(限NT200~20,000以內) 線上交易成功後, 我們將立即為你處理出貨的動作,謝謝。&lt;/div&gt;<br/><br/>&lt;div class=&quot;bS02 box bBW&quot;&gt;本公司與各大知名的宅配公司合作，您可以等到收到商品的同時，將貨款交付給該宅配公司即可。本項服務將代宅配代收手續費&lt;span style=&quot; color:red;&quot;&gt;30元&lt;/span&gt;。<br/>&lt;/div&gt;<br/><br/>&lt;!-- 如果開始要顯示要加入 style=&quot;display:block;&quot; 不顯示則加入&nbsp;&nbsp;style=&quot;display:none;&quot;--&gt;<br/>&lt;span class=&quot;bS01 box&quot;&gt;0元&lt;/span&gt;&lt;span class=&quot;bS02 box&quot;&gt;30元&lt;/span&gt;</div><br/><br/>參考：<br/><a href="http://www.tutorialrepublic.com/codelab.php?topic=faq&file=jquery-show-hide-div-using-radio-button" target="_blank">http://www.tutorialrepublic.com/codelab.php?topic=faq&file=jquery-show-hide-div-using-radio-button</a><br/>Tags - <a href="https://blog.apao.idv.tw/tags/radio/" rel="tag">radio</a> , <a href="https://blog.apao.idv.tw/tags/%25E9%2581%25B8%25E6%2593%2587%25E6%2599%2582/" rel="tag">選擇時</a> , <a href="https://blog.apao.idv.tw/tags/%25E9%259A%25B1%25E8%2597%258F/" rel="tag">隱藏</a> , <a href="https://blog.apao.idv.tw/tags/%25E7%25A7%2580%25E5%2587%25BA/" rel="tag">秀出</a> , <a href="https://blog.apao.idv.tw/tags/%25E5%258D%2580%25E5%25A1%258A/" rel="tag">區塊</a>
]]>
</description>
</item><item>
<link>https://blog.apao.idv.tw/post/1091/</link>
<title><![CDATA[[文字方式]  點擊連結隱藏或顯示DIV]]></title> 
<author>apao &lt;apao@www.apao.idv.tw&gt;</author>
<category><![CDATA[JavaScript]]></category>
<pubDate>Wed, 11 Mar 2015 19:48:46 +0000</pubDate> 
<guid>https://blog.apao.idv.tw/post/1091/</guid> 
<description>
<![CDATA[ 
	CSS部分<div class="code">&lt;style type=&quot;text/css&quot;&gt;<br/>span&#123;border:#999 solid 1px; padding:3px; border-radius:6px; -moz-border-radius:6px; -webkit-border-radius:6px;&#125;<br/>div#show&#123; margin:10px 0 0 0; padding:5px; border:#999 dashed 1px;&#125;<br/>&lt;/style&gt;</div><br/><br/>javascript 部分<div class="code">&lt;script type=&#039;text/javascript&#039;&gt;<br/>function show(obj, id)<br/>&#123;<br/>&nbsp;&nbsp;var o=document.getElementById(id);<br/>&nbsp;&nbsp;if( o.style.display == &#039;none&#039; )<br/>&nbsp;&nbsp;&#123;<br/>&nbsp;&nbsp;&nbsp;&nbsp;o.style.display=&#039;&#039;;<br/>&nbsp;&nbsp;&nbsp;&nbsp;obj.innerHTML=&#039;隱藏&#039;;<br/>&nbsp;&nbsp;&#125;<br/>&nbsp;&nbsp;else<br/>&nbsp;&nbsp;&#123;<br/>&nbsp;&nbsp;&nbsp;&nbsp;o.style.display=&#039;none&#039;;<br/>&nbsp;&nbsp;&nbsp;&nbsp;obj.innerHTML=&#039;顯示&#039;;<br/>&nbsp;&nbsp;&#125;<br/>&#125;<br/>&lt;/script&gt;</div><br/><br/>html 部分<div class="code">&lt;span onclick=&#039;show(this, &quot;show&quot;)&#039;&gt;顯示&lt;/span&gt;&lt;br&gt;<br/>&lt;div id=&#039;show&#039; style=&quot;display:none;&quot;&gt;按下文字按鈕後呈現內容&lt;/div&gt;</div><br/><br/><a href="http://goo.gl/hURxOu" target="_blank">網頁功能展示</a><br/><a href="http://goo.gl/hURxOu" target="_blank">http://goo.gl/hURxOu</a><br/>Tags - <a href="https://blog.apao.idv.tw/tags/%25E6%2596%2587%25E5%25AD%2597%25E6%2596%25B9%25E5%25BC%258F/" rel="tag">文字方式</a> , <a href="https://blog.apao.idv.tw/tags/%25E9%259A%25B1%25E8%2597%258F/" rel="tag">隱藏</a> , <a href="https://blog.apao.idv.tw/tags/%25E9%25A1%25AF%25E7%25A4%25BA/" rel="tag">顯示</a> , <a href="https://blog.apao.idv.tw/tags/javascript/" rel="tag">javascript</a> , <a href="https://blog.apao.idv.tw/tags/js/" rel="tag">js</a> , <a href="https://blog.apao.idv.tw/tags/div/" rel="tag">div</a> , <a href="https://blog.apao.idv.tw/tags/%25E9%2580%25A3%25E7%25B5%2590/" rel="tag">連結</a>
]]>
</description>
</item><item>
<link>https://blog.apao.idv.tw/post/1084/</link>
<title><![CDATA[[checkbox] 隱藏 顯示]]></title> 
<author>apao &lt;apao@www.apao.idv.tw&gt;</author>
<category><![CDATA[JavaScript]]></category>
<pubDate>Sun, 08 Mar 2015 06:30:34 +0000</pubDate> 
<guid>https://blog.apao.idv.tw/post/1084/</guid> 
<description>
<![CDATA[ 
	css部分<div class="code">&lt;style type=&quot;text/css&quot;&gt;<br/>div#show&#123; margin:10px 0 0 0; padding:5px; border:#999 dashed 1px;&#125;<br/>&lt;/style&gt;</div><br/><br/>javascript部分<div class="code">&lt;script type=&quot;text/javascript&quot;&gt;<br/>&lt;!--<br/>&nbsp;&nbsp;function show(obj,item)&#123;<br/>&nbsp;&nbsp;&nbsp;&nbsp;document.getElementById(item).style.display = obj.checked?&quot;block&quot;:&quot;none&quot;;<br/>&nbsp;&nbsp;&#125;<br/>//--&gt;<br/>&lt;/script&gt;</div><br/><br/>html部分<div class="code">&lt;input type=&quot;checkbox&quot; onclick=&quot;show(this,&#039;show&#039;);&quot; /&gt;<br/>&lt;div id=&quot;show&quot; style=&quot;display:none&quot;&gt;這是顯示的內容&lt;/div&gt;</div><br/>註：show可以任意改為其他文字<br/><br/><a href="http://goo.gl/ONVVvT" target="_blank">展示網頁</a><br/><a href="http://goo.gl/ONVVvT" target="_blank">http://goo.gl/ONVVvT</a><br/>----------------------------------<br/>單一選項做法<br/>在head中<br/><div class="code">&lt;script type=&quot;text/javascript&quot;&gt;<br/>&lt;!--<br/>&nbsp;&nbsp;//show()函式需要兩個參數：obj為CheckBox元素本身；item為Div區塊的id<br/>&nbsp;&nbsp;function show(obj,item)&#123;<br/>&nbsp;&nbsp;&nbsp;&nbsp;//判斷CheckBox是否被勾選 若是則顯示區塊 反之則隱藏<br/>&nbsp;&nbsp;&nbsp;&nbsp;document.getElementById(item).style.display = obj.checked?&quot;block&quot;:&quot;none&quot;;<br/>&nbsp;&nbsp;&#125;<br/>//--&gt;<br/>&lt;/script&gt;</div><br/>在Body中<br/><div class="code">&lt;input type=&quot;checkbox&quot; onclick=&quot;show(this,&#039;s2&#039;);&quot; /&gt;<br/>&lt;div id=&quot;s2&quot; style=&quot;display:none&quot;&gt;&lt;/div&gt;</div><br/><br/>-------------------------------------------<br/>多選項同時顯示或不顯示<br/>在head中<br/><div class="code">&lt;script type=&quot;text/javascript&quot;&gt;<br/>&lt;!--<br/>&nbsp;&nbsp;//items陣列用來紀錄要顯示/隱藏的區塊id<br/>&nbsp;&nbsp;var items = new Array(&quot;s2&quot;,&quot;s3&quot;);<br/>&nbsp;&nbsp;//show()函式需要一個參數：obj為CheckBox元素本身<br/>&nbsp;&nbsp;function show(obj)&#123;<br/>&nbsp;&nbsp;&nbsp;&nbsp;//一一取得items陣列中的物件 並判斷CheckBox是否被勾選 若是則顯示區塊 反之則隱藏<br/>&nbsp;&nbsp;&nbsp;&nbsp;for(var i=0;i&lt;items.length;i++)&#123;<br/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;document.getElementById(items&#91;i&#93;).style.display = obj.checked?&quot;block&quot;:&quot;none&quot;;<br/>&nbsp;&nbsp;&nbsp;&nbsp;&#125;<br/>&nbsp;&nbsp;&#125;<br/>//--&gt;<br/>&lt;/script&gt;</div><br/>在Body中<br/><div class="code">&lt;input type=&quot;checkbox&quot; onclick=&quot;show(this,&#039;s2&#039;);&quot; /&gt;<br/>&lt;div id=&quot;s2&quot; style=&quot;display:none&quot;&gt;&lt;/div&gt;<br/>&lt;input type=&quot;checkbox&quot; onclick=&quot;show(this,&#039;s3&#039;);&quot; /&gt;<br/>&lt;div id=&quot;s3&quot; style=&quot;display:none&quot;&gt;&lt;/div&gt;</div><br/>Tags - <a href="https://blog.apao.idv.tw/tags/css/" rel="tag">css</a> , <a href="https://blog.apao.idv.tw/tags/javascript/" rel="tag">javascript</a> , <a href="https://blog.apao.idv.tw/tags/%25E9%259A%25B1%25E8%2597%258F/" rel="tag">隱藏</a> , <a href="https://blog.apao.idv.tw/tags/%25E6%258E%25A7%25E5%2588%25B6/" rel="tag">控制</a> , <a href="https://blog.apao.idv.tw/tags/%25E9%2581%25B8%25E9%25A0%2585/" rel="tag">選項</a>
]]>
</description>
</item><item>
<link>https://blog.apao.idv.tw/post/1026/</link>
<title><![CDATA[手機版 判別式]]></title> 
<author>apao &lt;apao@www.apao.idv.tw&gt;</author>
<category><![CDATA[JavaScript]]></category>
<pubDate>Thu, 19 Jun 2014 03:17:44 +0000</pubDate> 
<guid>https://blog.apao.idv.tw/post/1026/</guid> 
<description>
<![CDATA[ 
	<div class="code">&lt;script type=&quot;text/javascript&quot;&gt;<br/>function checkserAgent()&#123;<br/>var userAgentInfo=navigator.userAgent;<br/>var userAgentKeywords=new Array(“Android&quot;, “iPhone&quot; ,&quot;SymbianOS&quot;, “Windows Phone&quot;, “iPad&quot;, “iPod&quot;, “MQQBrowser&quot;);<br/>var flag=false;<br/>if(userAgentInfo.indexOf(“Windows NT&quot;)==-1)&#123;<br/>flag=true;<br/>&#125;<br/>return flag;<br/>&#125;<br/>if(checkserAgent())&#123;<br/>document.location.href=&quot;http://www.apao.idv.tw/mobile/&quot;;<br/>&#125;<br/>&lt;/script&gt;</div><br/>Tags - <a href="https://blog.apao.idv.tw/tags/%25E6%2589%258B%25E6%25A9%259F%25E7%2589%2588/" rel="tag">手機版</a> , <a href="https://blog.apao.idv.tw/tags/%25E5%2588%25A4%25E5%2588%25A5/" rel="tag">判別</a> , <a href="https://blog.apao.idv.tw/tags/%25E5%25BC%258F/" rel="tag">式</a>
]]>
</description>
</item><item>
<link>https://blog.apao.idv.tw/post/899/</link>
<title><![CDATA[window.open 開啟另一視窗]]></title> 
<author>apao &lt;apao@www.apao.idv.tw&gt;</author>
<category><![CDATA[JavaScript]]></category>
<pubDate>Sat, 25 Aug 2012 10:59:31 +0000</pubDate> 
<guid>https://blog.apao.idv.tw/post/899/</guid> 
<description>
<![CDATA[ 
	<a href="https://blog.apao.idv.tw/attachment.php?fid=1463" target="_blank"><img src="https://blog.apao.idv.tw/attachment.php?fid=1463" class="insertimage" alt="點擊在新視窗中瀏覽此圖片" title="點擊在新視窗中瀏覽此圖片" border="0"/></a><br/><br/><div class="code"><br/>&lt;script LANGUAGE=&quot;JavaScript&quot;&gt; <br/>&lt;!-- <br/>　　function openwin() &#123; <br/>　　window.open (&quot;page.html&quot;, &quot;newwindow&quot;, &quot;height=100, width=400, toolbar =no, menubar=no, scrollbars=no, resizable=no, location=no, status=no&quot;) file://写成一行<br/><br/>　　&#125; <br/>//--&gt; <br/>&lt;/script&gt; </div><br/><br/>window.open 談出新視窗的命令文； <br/>'page.html' 弹出窗口的文件名； <br/>'newwindow' 彈出窗口的名字（不是文件名），可空白' '； <br/>height=100 窗口高度； <br/>width=400 窗口寬度； <br/>top=0 窗口距離瀏覽器上方的距離值； <br/>left=0 窗口距離瀏覽器左側的距離值； <br/>toolbar=no 是否顯示工具欄，yes為顯示； <br/>menubar，scrollbars 表示清單與滾動軸。 <br/>resizable=no 是否可改變視窗大小，yes为允許； <br/>location=no 是否显示地址栏，yes为允许； <br/>status=no 是否顯示狀態欄內的訊息（指是視窗開啟時），yes為允許；<br/><br/>html+javascript的寫法：<br/><br/><div class="code">&lt;html&gt; <br/>&lt;head&gt; <br/>&lt;script LANGUAGE=&quot;JavaScript&quot;&gt; <br/>&lt;!-- <br/>　　function openwin() &#123; <br/>　　window.open (&quot;page.html&quot;, &quot;newwindow&quot;, &quot;height=100, width=400, toolbar =no, menubar=no, scrollbars=no, resizable=no, location=no, status=no&quot;) //要寫成一行<br/>　　&#125; <br/>//--&gt; <br/>&lt;/script&gt; <br/>&lt;/head&gt; <br/>&lt;body onload=&quot;openwin()&quot;&gt; <br/>任意的頁面內容... <br/>&lt;/body&gt; <br/>&lt;/html&gt;</div><br/><br/>開啟新增視窗方法有四種：<br/><br/><div class="code">方法一：<br/>&lt;body&nbsp;&nbsp;onload=&quot;openwin()&quot;&gt; 瀏覽器開啟時(讀取時)彈出視窗； <br/><br/>方法二：<br/>&lt;body&nbsp;&nbsp;onunload=&quot;openwin()&quot;&gt; 瀏覽器離開頁面時(不讀取)彈出視窗； <br/><br/>方法三：用一个连接调用： <br/>&lt;a href=&quot;#&quot; onClick=&quot;window.open(&#039;URL&#039;, &#039;Joseph&#039;, config=&#039;height=350,width=440&#039;)&quot;/&gt;開啟一個新視窗&lt;/a&gt;<br/>注意：必須使用“#”<br/><br/>方法四：用於發布按鈕時： <br/>&lt;input type=&quot;button&quot; onclick=&quot;openwin()&quot; value=&quot;開啟視窗&quot;&gt;</div><br/><br/><br/>Tags - <a href="https://blog.apao.idv.tw/tags/window.open/" rel="tag">window.open</a> , <a href="https://blog.apao.idv.tw/tags/%25E9%2596%258B%25E5%2595%259F%25E5%258F%25A6%25E4%25B8%2580%25E8%25A6%2596%25E7%25AA%2597/" rel="tag">開啟另一視窗</a>
]]>
</description>
</item><item>
<link>https://blog.apao.idv.tw/post/824/</link>
<title><![CDATA[圖片自動滑動切換效果 (JavaScript_SlideTrans)]]></title> 
<author>apao &lt;apao@www.apao.idv.tw&gt;</author>
<category><![CDATA[JavaScript]]></category>
<pubDate>Tue, 11 Oct 2011 04:34:16 +0000</pubDate> 
<guid>https://blog.apao.idv.tw/post/824/</guid> 
<description>
<![CDATA[ 
	<a href="https://blog.apao.idv.tw/attachment.php?fid=1241" target="_blank"><img src="https://blog.apao.idv.tw/attachment.php?fid=1241" class="insertimage" alt="點擊在新視窗中瀏覽此圖片" title="點擊在新視窗中瀏覽此圖片" border="0"/></a><br/><a href="http://www.cnblogs.com/cloudgamer/archive/2008/07/06/1236770.html" target="_blank">DEMO</a><br/><br/>程序說明<br/>原理就是通過不斷設置滑動對象的left(水平切換)和top(垂直切換)來實現圖片切換的動態效果。<br/>首先需要一個容器，程序會自動設置容器overflow為hidden，如果不是相對或絕對定位會同時設置position為relative，<br/>滑動對象會設置為絕對定位：<br/><div class="code">var p = CurrentStyle(this._container).position;<br/>p == &quot;relative&quot; &#124;&#124; p == &quot;absolute&quot; &#124;&#124; (this._container.style.position = &quot;relative&quot;);<br/>this._container.style.overflow = &quot;hidden&quot;;<br/>this._slider.style.position = &quot;absolute&quot;;<br/></div><br/>如果沒有設置Change切換參數屬性，會自動根據滑動對象獲取：<br/><div class="code">this.Change = this.options.Change ? this.options.Change :<br/>&nbsp;&nbsp;&nbsp;&nbsp;this._slider&#91;bVertical ? &quot;offsetHeight&quot; : &quot;offsetWidth&quot;&#93; / this._count;<br/></div><br/>執行Run方法就會開始進入切換，其中有一個可選參數用來重新設置要切換的圖片索引：<br/><div class="code">index == undefined &amp;&amp; (index = this.Index);<br/>index &lt; 0 &amp;&amp; (index = this._count - 1) &#124;&#124; index &gt;= this._count &amp;&amp; (index = 0);<br/></div><br/>之後就到設置使用tween緩動時需要的參數了，<br/>包括_target(目標值)、_t(時間)、_b(初始值)和_c(變化量)：<br/><div class="code">this._target = -Math.abs(this.Change) * (this.Index = index);<br/>this._t = 0;<br/>this._b = parseInt(CurrentStyle(this._slider)&#91;this.options.Vertical ? &quot;top&quot; : &quot;left&quot;&#93;);<br/>this._c = this._target - this._b;<br/></div><br/>還有Duration(持續時間)是自定義屬性。<br/>參數設置好後就執行Move程序開始移動了。<br/>裡面很簡單，首先判斷_c是否有值（等於0表示不需要移動）和_t是否到達Duration，<br/>未滿足條件就繼續移動，否則直接移動到目標值並進行下一次切換：<br/><div class="code">if (this._c &amp;&amp; this._t &lt; this.Duration) &#123;<br/>&nbsp;&nbsp;&nbsp;&nbsp;this.MoveTo(Math.round(this.Tween(this._t++, this._b, this._c, this.Duration)));<br/>&nbsp;&nbsp;&nbsp;&nbsp;this._timer = setTimeout(Bind(this, this.Move), this.Time);<br/>&#125;else&#123;<br/>&nbsp;&nbsp;&nbsp;&nbsp;this.MoveTo(this._target);<br/>&nbsp;&nbsp;&nbsp;&nbsp;this.Auto &amp;&amp; (this._timer = setTimeout(Bind(this, this.Next), this.Pause));<br/>&#125;<br/></div><br/>使用說明：<br/>1.html中確認Slider的數量與圖片之寬高<br/>2.SlideTrans.js中改變圖片成現方式的數據<br/><br/>實例化需要3個參數，分別是容器對象，滑動對象和切換數量，之後可以直接執行Run方法運行：<br/>HTML的CSS中找出：<br/><div class="code">.container, .container img&#123;width:199px; height:38px;&#125;</div><br/>HTML的script中找出(<strong>4</strong>為圖片數目)：<br/><div class="code">new SlideTrans(&quot;idContainer&quot;, &quot;idSlider&quot;, 4, &#123; Vertical: false &#125;).Run();<br/></div><br/>SlideTrans.js 中找出：<br/><div class="code">Vertical:&nbsp;&nbsp;true,//是否垂直方向（方向不能改）<br/>Auto:&nbsp;&nbsp;&nbsp;&nbsp;true,//是否自動<br/>Change:&nbsp;&nbsp;&nbsp;&nbsp;0,//改變數<br/>Duration:&nbsp;&nbsp;40,//滑動持續時間<br/>Time:&nbsp;&nbsp;&nbsp;&nbsp;25,//滑動延時<br/>Pause:&nbsp;&nbsp;&nbsp;&nbsp;4000,//停頓時間(Auto為true時有效)<br/>onStart:&nbsp;&nbsp;function()&#123;&#125;,//開始轉換時執行<br/>onFinish:&nbsp;&nbsp;function()&#123;&#125;,//完成轉換時執行<br/>Tween:&nbsp;&nbsp;&nbsp;&nbsp;Tween.Quart.easeOut//tween算子</div><br/>其中Vertical初始化後就不能修改，Tween算子可參照這裡的緩動效果選擇（實例中選了其中3個）。<br/>還有提供了以下方法：<br/>Next:切換下一個<br/>Previous:切換上一個<br/>Stop:停止自動切換<br/>還有上面說到的Run<br/>這個檔案只能在登入之後下載。請先 <a href="https://blog.apao.idv.tw/login.php?job=register">註冊</a> 或 <a href="https://blog.apao.idv.tw/login.php">登入</a><br/>Tags - <a href="https://blog.apao.idv.tw/tags/%25E5%259C%2596%25E7%2589%2587/" rel="tag">圖片</a> , <a href="https://blog.apao.idv.tw/tags/%25E8%2587%25AA%25E5%258B%2595/" rel="tag">自動</a> , <a href="https://blog.apao.idv.tw/tags/%25E6%25BB%2591%25E5%258B%2595/" rel="tag">滑動</a> , <a href="https://blog.apao.idv.tw/tags/%25E5%2588%2587%25E6%258F%259B/" rel="tag">切換</a> , <a href="https://blog.apao.idv.tw/tags/%25E6%2595%2588%25E6%259E%259C/" rel="tag">效果</a> , <a href="https://blog.apao.idv.tw/tags/%2528javascript_slidetrans%2529/" rel="tag">(javascript slidetrans)</a>
]]>
</description>
</item><item>
<link>https://blog.apao.idv.tw/post/635/</link>
<title><![CDATA[關閉視窗]]></title> 
<author>apao &lt;apao@www.apao.idv.tw&gt;</author>
<category><![CDATA[JavaScript]]></category>
<pubDate>Fri, 06 Aug 2010 02:17:18 +0000</pubDate> 
<guid>https://blog.apao.idv.tw/post/635/</guid> 
<description>
<![CDATA[ 
	以下放至於<strong><span style="font-size: 120%;">&lt;body&gt;</span></strong>與<strong><span style="font-size: 120%;">&lt;/body&gt;</span></strong>之間<br/><hr/><br/>&lt;a href=&quot;#&quot; onClick=&quot;window.close(); return false;&quot;&gt;<span style="color: #8B0000;"><strong>close window</strong></span>&lt;/a&gt;<br/><br/><hr/>備註︰<br/><span style="color: #8B0000;"><strong>close window</strong></span>可以自由置換<br/><hr/>參考連結︰<br/><a href="http://www.livemusic98.com/map.html" target="_blank">http://www.livemusic98.com/map.html</a><hr/><br/><br/>Tags - <a href="https://blog.apao.idv.tw/tags/%25E9%2597%259C%25E9%2596%2589%25E8%25A6%2596%25E7%25AA%2597/" rel="tag">關閉視窗</a>
]]>
</description>
</item><item>
<link>https://blog.apao.idv.tw/post/634/</link>
<title><![CDATA[走馬燈 (右向左)]]></title> 
<author>apao &lt;apao@www.apao.idv.tw&gt;</author>
<category><![CDATA[JavaScript]]></category>
<pubDate>Thu, 05 Aug 2010 07:39:21 +0000</pubDate> 
<guid>https://blog.apao.idv.tw/post/634/</guid> 
<description>
<![CDATA[ 
	以下放至於<strong><span style="font-size: 120%;">&lt;body &gt;</span></strong>與<strong><span style="font-size: 120%;">&lt;/body&gt;</span></strong>之間<br/><hr/><br/>&lt;SCRIPT language=&quot;JavaScript&quot;&gt;&lt;!--<br/>myMsg = &quot;<span style="color: #00008B;">你好歡迎光臨！你好歡迎光臨！你好歡迎光臨！　　　</span>&quot;;<br/>myMsg = myMsg + myMsg;<br/>myCnt = 0;<br/>function myFunc()&#123;<br/>&nbsp;&nbsp;document.myForm.myFormMes.value = myMsg.substring(myCnt,myMsg.length);<br/>&nbsp;&nbsp;myCnt = ( myCnt == (myMsg.length/2)-1 ) ? 0 : myCnt+1;<br/>&#125;<br/>// --&gt;&lt;/SCRIPT&gt;<br/><br/>&lt;form name=&quot;myForm&quot;&gt;<br/>&lt;input type=&quot;text&quot; <span style="color: #00008B;">size=&quot;30&quot;</span> name=&quot;myFormMes&quot;&gt;<br/>&lt;/form&gt;<br/>&lt;SCRIPT language=&quot;JavaScript&quot;&gt;&lt;!--<br/>setInterval(&quot;myFunc()&quot;,200);<br/>// --&gt;&lt;/SCRIPT&gt;<br/><hr/>備註︰<br/><span style="color: #00008B;">你好歡迎光臨！你好歡迎光臨！你好歡迎光臨！　　　</span>←可自由置換，留空白有助於斷字，較容易理解。<br/><span style="color: #00008B;">size=&quot;30&quot;</span>←可用CSS控制寬度等等，較容易適用於各瀏覽器內。<br/><hr/>參考連結︰<br/><a href="http://www.livemusic98.com" target="_blank">http://www.livemusic98.com</a><br/>Tags - <a href="https://blog.apao.idv.tw/tags/%25E8%25B5%25B0%25E9%25A6%25AC%25E7%2587%2588/" rel="tag">走馬燈</a> , <a href="https://blog.apao.idv.tw/tags/%25E5%258F%25B3%25E5%2590%2591%25E5%25B7%25A6/" rel="tag">右向左</a> , <a href="https://blog.apao.idv.tw/tags/javascript/" rel="tag">javascript</a>
]]>
</description>
</item><item>
<link>https://blog.apao.idv.tw/post/633/</link>
<title><![CDATA[JavaScript 走馬燈 (一個字一個字出現)]]></title> 
<author>apao &lt;apao@www.apao.idv.tw&gt;</author>
<category><![CDATA[JavaScript]]></category>
<pubDate>Wed, 04 Aug 2010 16:58:54 +0000</pubDate> 
<guid>https://blog.apao.idv.tw/post/633/</guid> 
<description>
<![CDATA[ 
	<strong>範例來自︰<a href="http://www.fa-hua.com.tw" target="_blank">http://www.fa-hua.com.tw</a></strong><br/><br/><iframe id="message1" name="message1" src="http://www.fa-hua.com.tw/message_20090531.html" frameborder="0" scrolling="no" height="30" width="538"></iframe><br/><br/>以下放至於<strong><span style="font-size: 120%;">&lt;body&gt;</span></strong>與<strong><span style="font-size: 120%;">&lt;/body&gt;</span></strong>之間<br/><hr/><br/>&lt;SCRIPT language=&quot;JavaScript&quot;&gt;&lt;!--<br/>myMsg = &quot; <strong><span style="color: #00008B;">你好歡迎光臨！</span></strong>&quot;;<br/>myCnt = 0;<br/>myDspFlg = 0;<br/><br/><br/>function myFunc()&#123;<br/>&nbsp;&nbsp;if ( myDspFlg == 0 )&#123;<br/>&nbsp;&nbsp;&nbsp;&nbsp;document.myForm.myFormMes.value = myMsg.substring(0,myCnt);<br/>&nbsp;&nbsp;&nbsp;&nbsp;if ( myCnt == myMsg.length )&#123;<br/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;myCnt = 0;<br/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;myDspFlg = 1;<br/>&nbsp;&nbsp;&nbsp;&nbsp;&#125;else&#123;<br/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;myCnt += 1;<br/>&nbsp;&nbsp;&nbsp;&nbsp;&#125;<br/>&nbsp;&nbsp;&#125;else if ( myDspFlg == 1 )&#123;<br/>&nbsp;&nbsp;&nbsp;&nbsp;document.myForm.myFormMes.value = &quot;&quot;;<br/>&nbsp;&nbsp;&nbsp;&nbsp;myDspFlg = 2;<br/>&nbsp;&nbsp;&#125;else&#123;<br/>&nbsp;&nbsp;&nbsp;&nbsp;document.myForm.myFormMes.value = myMsg;<br/>&nbsp;&nbsp;&nbsp;&nbsp;myCnt ++;<br/>&nbsp;&nbsp;&nbsp;&nbsp;if ( myCnt == 5 )&#123;<br/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;myDspFlg = 0;<br/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;myCnt = 0;<br/>&nbsp;&nbsp;&nbsp;&nbsp;&#125;else&#123;<br/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;myDspFlg = 1;<br/>&nbsp;&nbsp;&nbsp;&nbsp;&#125;<br/>&nbsp;&nbsp;&#125;<br/>&#125;<br/>// --&gt;&lt;/SCRIPT&gt;<br/><br/>&lt;form name=&quot;myForm&quot;&gt;<br/>&lt;input type=&quot;text&quot; <span style="color: #00008B;">size=&quot;30&quot;</span> name=&quot;myFormMes&quot;&gt;<br/>&lt;/form&gt;<br/>&lt;SCRIPT language=&quot;JavaScript&quot;&gt;&lt;!--<br/> setInterval(&quot;myFunc()&quot;,200);<br/>// --&gt;&lt;/SCRIPT&gt;<br/><br/><hr/>備註︰<br/><strong><span style="color: #00008B;">你好歡迎光臨！</span></strong>←可自由置換<br/><span style="color: #00008B;">size=&quot;30&quot;</span>←可以CSS指定寬度等等，較適用於各瀏覽器。<br/><hr/><br/>Tags - <a href="https://blog.apao.idv.tw/tags/javascript/" rel="tag">javascript</a> , <a href="https://blog.apao.idv.tw/tags/%25E8%25B5%25B0%25E9%25A6%25AC%25E7%2587%2588/" rel="tag">走馬燈</a>
]]>
</description>
</item>
</channel>
</rss>