[advanced search]
Results from the most recent live auction are here.
11 members in the live chat room. Join Chat!
Register Rules & FAQ NP$ Store Active Threads Mark Forums Read
Go Back   NamePros.Com > Design and Development > Programming > CODE
User Name
Password

Old 09-27-2006, 04:33 PM   · #1
jeka911
New Member
 
Trader Rating: (0)
Join Date: Sep 2006
Posts: 17
NP$: 0.00 (Donate)
jeka911 is an unknown quantity at this point
javascript_escape_string (PHP)

Escapes string, so it can be used inside javascript:

<?
function javascript_escape_string($str)
{
$str = str_replace(array('\\', "'"), array("\\\\", "\\'"), $str);
$str = preg_replace('#([\x00-\x1F])#e', '"\x" . sprintf("%02x", ord("\1"))',$str);
return $str;
}
?>

example:

<script language="javascript" type="text/javascript">
<!--
document.write('<? echo javascript_escape_string($str); ?>');

// -->
</script>


Please register or log-in into NamePros to hide ads
jeka911 is offline   Reply With Quote
Closed Thread

NamePros is a revenue sharing forum.

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Forum Jump


Site Sponsors
Proof is in the Parking Traffic Down Under http://www.mobisitetrader.com/
Advertise your business at NamePros
All times are GMT -7. The time now is 09:54 AM.


Powered by: vBulletin Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Search Engine Friendly URLs by vBSEO 2.4.0