Thursday, 13 November 2014

Tuto : Open New Tab

Assalamualaikum :)

Hello peeps. Now, Ira nak ajar korang satu tutorial yang senang gila. Tutorial ni kalau kita tekan dia akan pergi ke new tab. Contohnya macam ni CLICK HERE. Haa, link tu pergi kat new tab kan? :)

1. Layout > Add A Gadget > HTML/Javasript
2. Copy code ni dan paste kan kat ruangan HTML/JavaScript tu k?

<!-- code for turning all non-blog links to new page links -->
<script type="text/javascript" language="javascript">
var arr = document.getElementsByTagName("a"); //get all links in the page
for(var i = 0; i < arr.length; i++)
{
if(arr[i].href.indexOf("URL") < 0 //not links that are 'inside' blog
&& arr[i].href.indexOf("javascript:") < 0) //not javascript links
arr[i].target = "_blank";
}
</script>

3. Save and view blog korang. Try test click mana-mana link, jadi ke tak? :)

Good Luck !

No comments: