Tạo khung code converter cho blog
![]() |
| 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>"
//<![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 "<"
else if (match==">")
return ">"
else if (match=="\"")
return """
else if (match=="'")
return "'"
else if (match=="&")
return "&"
}
//]]>
</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:

Facebook
Twitter
Google+
Rss Feed


0 nhận xét: