Vadymus
asked on
Escape Character Help: onclick='myFunction(1,"+iParseThisString+")'
Hello,
If you know about how to use escape character, I think it should be very easy for you to help me.
I need to parse string variable within single quotes like this:
var iParseThisString = "Hello";
document.write ("<table><tr><td onclick='myFunction(1,"+iP arseThisSt ring+")'>L ink</td></ tr></table >");
THE PROBLEM IS: iParseThisString as a string cannot be parsed.
Error is "Hello is not defined"
Character \ must be used, but how?..................
Thanks.
If you know about how to use escape character, I think it should be very easy for you to help me.
I need to parse string variable within single quotes like this:
var iParseThisString = "Hello";
document.write ("<table><tr><td onclick='myFunction(1,"+iP
THE PROBLEM IS: iParseThisString as a string cannot be parsed.
Error is "Hello is not defined"
Character \ must be used, but how?..................
Thanks.
ASKER
Unfortunately, that did not work for me.
To be more precise, this is my code:
var iParseThisString = "Hello";
var iParseThisNum = 553;
array("<table><tr><td onclick='myFunction("+iPar seThisNum+ ","+iParse ThisString +",1)'>Lin k</td></tr ></table>" );
Note: iParseThisNum works well because it is a number, but iParseThisString does not
Thank you for your help.
To be more precise, this is my code:
var iParseThisString = "Hello";
var iParseThisNum = 553;
array("<table><tr><td onclick='myFunction("+iPar
Note: iParseThisNum works well because it is a number, but iParseThisString does not
Thank you for your help.
ASKER
Also, it works well if I write the string as it is without variable:
array("<table><tr><td onclick='myFunction("+iPar seThisNum+ ",\"Hello\ ",1)'>Link </td></tr> </table>") ;
But how to make that "Hello" be a string variable instead?
array("<table><tr><td onclick='myFunction("+iPar
But how to make that "Hello" be a string variable instead?
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
marvelous!
document.write ("<table><tr><td onclick=\"myFunction(1,'"+
-r-