HighDots Forums  

function argument with quote (single, double) mark.

Javascript JavaScript language (comp.lang.javascript)


Discuss function argument with quote (single, double) mark. in the Javascript forum.



Reply
 
Thread Tools Display Modes
  #1  
Old   
iaminsik
 
Posts: n/a

Default function argument with quote (single, double) mark. - 07-19-2007 , 05:40 AM






Hi, I made a function prototype :
<head>
<script type="text/javascript">
function test (value) { alert (value); }
</script>
</head>

Now, I hope to call it with quoted string like this :
<body>
<input style="cursor: hand;" type="button" value="ÀÚ·á¼öÁ¤Ã¢ ¿*±â"
onmousedown="test( ' "abc' )" />
<input style="cursor: hand;" type="button" value="ÀÚ·á¼öÁ¤Ã¢ ¿*±â"
onmousedown="test( ' 'abc' )" />
</body>

But, as you know, a parsing error can occur in HTML.

In short, How can I transfer a string which has a quote (single or
double) character?


Reply With Quote
  #2  
Old   
David Mark
 
Posts: n/a

Default Re: function argument with quote (single, double) mark. - 07-19-2007 , 12:12 PM







"iaminsik" <iaminsik (AT) gmail (DOT) com> wrote

Quote:
Hi, I made a function prototype :
head
<script type="text/javascript">
function test (value) { alert (value); }
</script>
</head>

Quote:
Now, I hope to call it with quoted string like this :
body
<input style="cursor: hand;" type="button" value="ÀÚ·á¼öÁ¤Ã¢ ¿*±â"
onmousedown="test( ' "abc' )" />
<input style="cursor: hand;" type="button" value="ÀÚ·á¼öÁ¤Ã¢ ¿*±â"
onmousedown="test( ' 'abc' )" />
</body>

Quote:
But, as you know, a parsing error can occur in HTML.

In short, How can I transfer a string which has a quote (single or
double) character?

Like this:

<input style="cursor: hand;" type="button" value="test"
onmousedown="test( '&quot;abc' )" />
<input style="cursor: hand;" type="button" value="test"
onmousedown="test( &quot;'abc&quot; )" />

And I wouldn't use the mousedown event on a button to do anything. The
click event would be more appropriate.





Reply With Quote
Reply




Thread Tools
Display Modes

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 On
HTML code is Off



Powered by vBulletin Version 3.5.4
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.