大部份的網路廣告商和web2.0的工具,都會提供javascript的外部導入連結(.js),方便使用者放置在自己的網站或部落格中…但如果把它提供的js檔抓下來分析,就會發現最後常會轉成輸出iframe、flash或是其它程式檔。

這樣的做法,通常是為簡化連結語法(跟flash的語法比要短得多)或是增加一些輸出控制,另外,支援javascript的BSP,也比支援iframe來得多。
拿funp的推文按鈕funp_button.js為例:
var button_dimension = {
1 : {'w' : 60, 'h': 55 },
2 : {'w' : 60, 'h': 69 },
3 : {'w' : 80, 'h': 15 },
4 : {'w' : 91, 'h': 17 },
5 : {'w' : 95, 'h': 22 },
6 : {'w' :115, 'h': 22 },
7 : {'w' : 60, 'h': 66 },
8 : {'w' :100, 'h': 34 },
9 : {'w' :106, 'h': 55 },
10 : {'w' : 60, 'h': 55 },
11 : {'w' :100, 'h': 20 },
12 : {'w' : 80, 'h': 15 },
13 : {'w' : 80, 'h': 15 }
};
function funp_genButton(url,style) {
if (!style) style = 1;
if (!url) url='';
else url="?url="+encodeURIComponent(url);
//注意這裡,輸出iframe
document.write('');
}
<iframe src="http://andy.diimii.com/wp-monster/pr_interface.php?pr_code=uz437qO5MdtT5BJLiuiR3hT0RR6578&cols=2&rows=2&type=1&category=0&price1=0&price2=0&sp=0&adult=&sadult=0&keyword=&bgcolor=FFFFFF&page=0&login=sunho&webapipassword=2aa3a721693697a4827156a311810284" width="330" height="430" marginheight="0" marginwidth="0" scrolling="no" frameborder="0"></iframe>
(2) 用這工具:HTML to JavaScript Convertor
(3) 得到javascript的輸出格式
function writeJS(){
var str='';
str+='<iframe src="http:\/\/andy.diimii.com\/wp-monster\/pr_interface.php?pr_code=uz437qO5MdtT5BJLiuiR3hT0RR6578&cols=2&rows=2&type=1&category=0&price1=0&price2=0&sp=0&adult=&sadult=0&keyword=&bgcolor=FFFFFF&page=0&login=sunho&webapipassword=2aa3a721693697a4827156a311810284" width="330" height="430" marginheight="0" marginwidth="0" scrolling="no" frameborder="0"><\/iframe>';
document.write(str);
}
writeJS();
(4) 複製上述內容,把它存為一個新檔如:andy_monster.js
(5) 在網站上使用它,搞定
<script type="text/javascript" src="http://js.diimii.com/01/andy_monster.js"></script>
在Google及Yahoo找資料,已成為許多人每天必行的公事。「網路」的無遠弗屆,造就了一個世界級的知識寶庫,著實讓我受益良多。
設立此部落格除用做網路行銷、學習記事與知識管理外,希望也能做些回饋和經驗分享,如果有人能從這裡的文章得到一點幫助就好了...
網站生日:2008/09/16 年紀:41個多月
kenneth
三月 30th, 2009 at 8:47 下午
喔喔原來如此啊,又學到一招了