Q:

While creating a dynamic radio box, couldn't pass a string to onClick function

I have to render a couple of radio buttons dynamically when loading a page because the number of radio buttons depends on number of rows of data received in a JSP. 
Here I have shown it using innerHTML. The problem is when I am using the onClick function and passing the variables : a & b ; to doOption()function, the variable b which is supposed to be a string, is referred to as a the whole function definition in that onClick function.
---------------------------
Message from webpage
---------------------------
a : 123, b : function abc()
{
var a = 123;
var b ="abc";
document.getElementById('1').innerHTML = 
"<input type='radio' onClick='doOption("+a+","+b+")'>";
}
---------------------------
OK       
---------------------------

<html>  
<body onload=abc()>
<script>
function doOption(a,b){ 
alert("a : "+a+", b : "+b);
}
function abc(){
    var a = 123;
    var b ="abc";
    document.getElementById('1').innerHTML = 
    "<input type='radio' onClick='doOption("+a+","+b+")'>";
}
</script>
<p id='1'>
</p>
</body>
</html>

A:

Try this. You need to use below:
<html>  
<body onload=abc()>
<script>
function doOption(c,d){ 
    alert(c+" "+d);
}
function abc(){
    var a = 123;
    var b ="abc";
    document.getElementById("ptag").innerHTML = "<input type='radio' onclick='doOption("+a+",\""+b+"\")'>";
}
</script>
<p id="ptag">
</p>
</body>
</html>

