Thursday, July 2, 2015

Tạo khung code converter cho blog

Posted by dientudieukhien at 1:06 PM 0 Comments
Việc bạn lấy code từ các trang publisher, adsense... khi chèn vào source code template của blogspot thường sẽ xảy ra lỗi do code không tương thích. Do vậy, trước khi chèn vào template bạn cần phải chuyển đổi cho phù hợp với code nguồn. Sau đây, mình sẽ hướng dẫn bạn tạo một box code converter như thế:
how to make code converter
Một box code converter


Để tạo được một box code convert như trên bạn có hai cách.
Cách 1: đơn giản, bạn chỉ cần chèn iframe sau vào một Widget:


<iframe align="middle" allowtransparency="true" frameborder="0" height="280px" marginheight="0" marginwidth="2" scrolling="no" src="http://www.dientudieukhien.net/p/converter.html" width="100%"></iframe><a style="font-size: x-small;" href="http://dientudieukhien.net">Dientudieukhien.net</a>



Cách 2: Phức tạp hơn chút

  • Trước tiên bạn dán đoạn code sau phía trên "</head>"
<script type='text/javascript'>
//<![CDATA[
function html2entities(){
var re=/[<>"'&]/g
for (i=0; i<arguments.length; i++)
arguments[i].value=arguments[i].value.replace(re, function(m){return replacechar(m)})
}

function replacechar(match){
if (match=="<")
return "&lt;"
else if (match==">")
return "&gt;"
else if (match=="\"")
return "&quot;"
else if (match=="'")
return "&#039;"
else if (match=="&")
return "&amp;"
}
//]]>
</script>
<script type='text/javascript'>

//<![CDATA[

//Character count script
function countit(what){
formcontent=what.form.charcount.value
what.form.displaycount.value=formcontent.length
}

//]]>
</script>

  • Tiếp theo bạn paste code sau vào vị trí mà bạn muốn xuất hiện box code converter này:
<form>
  <p><font color="#6B828E" size="2" face="Arial, Helvetica, sans-serif"> </font></p>
<p>
    <font color="#6B828E" size="2" face="Arial, Helvetica, sans-serif"><textarea name="data1" style="width: 485px; height: 200px;overflow:hidden; background-image:url(html-coder-txt.jpg); background-repeat:no-repeat; padding:10px;"></textarea>
  </font></p>
  <p align=""><font color="#6B828E" size="2" face="Arial, Helvetica, sans-serif"><br>
      <input name="button" type="button" class="abt2" onClick="html2entities(this.form.data1)" onMouseOver="this.className='abt2 abt2hov'" onMouseOut="this.className='abt2'" value="Convert"> 
      <input onMouseOver="this.className='abt3 abt3hov'" onMouseOut="this.className='abt3'" class="abt3" name="Clear" value="  Clear  " type="reset">
    
</form>

Chúc bạn thành công!
nguồn: dientudieukhien.net

Click vào link tải ở trên đợi 5 giây, ấn "Bỏ qua quảng cáo". Click the link above, wait for 5s and click button "Skip Ad"

Chia sẽ bài viết này

Cập nhật tin bài mới

Subscribe địa chỉ mail để nhận tin nhanh chóng. Chúng tôi sẽ giữ bí mật địa chỉ mail của bạn.

0 nhận xét:

    tab

back to top