4
Contributors
5
Replies
6
Views
7 Years
Discussion Span
Last Post by Taywin
0

Sorry, I am not going to register on the site... But one suggestion that you may need to look for is to escape string before you pass into any function. Normally, the string contains special characters, especially single or double quote, that JavaScript may not end correctly.

To me more clear, I will give you an example. A function readStuff(str) takes 'str' as argument. When you call it, you would simply call and pass a string in. If the string contain special character, JavaScript will break.

Example:
<html>
 <head>
 <script type="text/javascript">
 function breakMe(str) {
  alert(str)
 }
 </script>
 </head>

 <body>
 <script type="text/javascript">
 var someString = "I want to \"BREAK\" the function"
 breakMe(someString)
 </script>
 </body>
</html>

JavaScript will stop working in this case even though you have escape the word BREAK in your string variable. You just need to be more careful when work with string. There are various ways to fix this...

0

There are various ways to fix this...

...all of which no doubt come too late for the OP.

The problem was raised nine months ago.

0

JavaScript will stop working in this case

In which case? Exactly what is your code snippet supposed to do? Or not do?

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.