View Single Post
  #8 (permalink)  
Old 08-09-2007, 12:00 PM
wige's Avatar
wige wige is offline
Moderator
WebProWorld Moderator
 

Join Date: Jun 2006
Location: United States
Posts: 1,825
wige RepRank 4wige RepRank 4wige RepRank 4wige RepRank 4
Default Re: Javascript and those naughty characters...

I grabbed one of the search results from the finial search.

HTML Code:
<script type="text/JavaScript">
var outputstr = "4 1/4"H, 6 1/4"L, 4"P.  Sold as each. "
/*var textpreview = "4 1/4"H, 6 1/4"L, 4"P.  Sold as each. "*/
/*var textpreview = outputstr.replace(/[\/=;:.<>'&_,%`"@~#]/gi," ")*/
var textpreview = outputstr.replace(/[^a-zA-Z 0-9]+/g,'') 

if (textpreview.length > 50)
{
document.write(textpreview.substr(0,50) + "&nbsp;...")
}
else
{
document.write(textpreview)
}
</script>
How is the first line of the script generated? This is where the script breaks, before even reaching the regular expression.
__________________
The best way to learn anything, is to question everything.
Reply With Quote