ThaiSEOBoard.com

พัฒนาเว็บไซต์ => Programming => หัวข้อเริ่มโดย: zatoli30 ใน 13 สิงหาคม 2012, 23:14:49

ชื่อเรื่อง: ขอความช่วยเหลือ js ครับ
โพสต์โดย: zatoli30 ใน 13 สิงหาคม 2012, 23:14:49
คือว่าผมจะแปลงโค้ด ascii แบบนี้

<a href="#">Mycomsci</a>'; ให้ออกมาเป็นแบบนี้ ไม่ทราบต้องทำยังไงครับ

<a href="#">Mycomsci</a> นั่งงมมานานแล้วครับ ปล.มือใหม่ครับ

ขอบคุณครับ  :wanwan017: :wanwan017:
ชื่อเรื่อง: Re: ขอความช่วยเหลือ js ครับ
โพสต์โดย: @@@ ใน 14 สิงหาคม 2012, 14:18:50
ใช้ unescape

<script language="javascript">document.write(unescape('&lt;a href=&quot;#&quot;&gt;Mycomsci&lt;/a&gt;'))</script>
ชื่อเรื่อง: Re: ขอความช่วยเหลือ js ครับ
โพสต์โดย: zatoli30 ใน 14 สิงหาคม 2012, 18:41:26
ขอบคุณครับ
ชื่อเรื่อง: Re: ขอความช่วยเหลือ js ครับ
โพสต์โดย: xvlnw.com ใน 14 สิงหาคม 2012, 18:45:20

this function

<?php 
function htmlkarakter($string

   
$string str_replace(array("&lt;""&gt;"'&amp;'''', '&quot;','&lt;', '&gt;'), array("<", ">",'&',''','"','<','>'), htmlspecialchars_decode($stringENT_NOQUOTES)); 

       return 
$string
   

?>



Before
<description>&lt;div class=&quot;google-ad1&quot;&gt;
  &lt;script type='text/javascript'&gt;
    GA_googleFillSlot(&quot;EW_News_300x250&quot;);
  &lt;/script&gt;

&lt;/div&gt;

after using the function

<div class="google-ad1">
  <script type='text/javascript'>
    GA_googleFillSlot("EW_News_300x250");
  </script>

Edit: อ่านเพิ่มเติม
http://www.php.net/manual/en/function.htmlspecialchars-decode.php
ส่วนนี้สำหรับ PHP นะครับ เสริมไว้ให้