H
howachen
Hi,
I have one very simple tricky question which is quite interesting, I
would like to share with all of you here...
//=======================================
<script type="text/javascript">
function func1() {
var str = "123\'s";
document.write('<a href="javascript:alert(\'' + str+'\')">test
link</a>');
}
</script>
//=======================================
If "str" is just a normal text, e.g. "123", then you can have a link
which lead to an alert box when onclick.
However, when there is a quote in the string, the function will not
work...
Any workaround for this problem?
Thanks.
Rdgs,
Howa
I have one very simple tricky question which is quite interesting, I
would like to share with all of you here...
//=======================================
<script type="text/javascript">
function func1() {
var str = "123\'s";
document.write('<a href="javascript:alert(\'' + str+'\')">test
link</a>');
}
</script>
//=======================================
If "str" is just a normal text, e.g. "123", then you can have a link
which lead to an alert box when onclick.
However, when there is a quote in the string, the function will not
work...
Any workaround for this problem?
Thanks.
Rdgs,
Howa