I have 2 function in my code - makeData and displayData -.
<script type="text/javascript">
function makeData(){
var myjson = {}; var myarray = [];
for (var i = 0; i < 10; i++){
myjson[i] = "json"+i;
myarray[i] = "array"+i;
}
//when i pass myjson[1] and myarray[1] value, it's work for me
$("#mydiv").html("<input type=\"button\" value=\"display data\"
onclick=displayData(\""+myjson[0]+"\",\""+myarray[0]+"\") />");
/*but when i tried to pass the json and array object, i got problem here.
displayData() function cannot read those objects*/
$("#mydiv").html("<input type=\"button\" value=\"display data\"
onclick=displayData(\""+myjson+"\",\""+myarray+"\") />");
}
</script>
<input type="button" value="make some button" onclick="makeData()" />
<div id="mydiv"></div>
<div id="dataDisplay"></div>
how can i pass array / json object to javascript function that write using innerHTML ???
note : my purpose is to pass set of data to javascript function.
edit : i think now it is more clearly now. sorry about before..
window.eventis IE-only!)