:: Forum >>

Can I put a Javascript function in the Array?

When the data gets put into the array I want to be able to call a javascript function on the click event, is this possible? i.e.

var myData = [
["<a href='#' onclick='runJava('test');'>Click Me</a>"]
]
Tom Hughes
Friday, March 14, 2008
Yes, that should work, but you should be careful with nested quotes -

var myData = [
["<a href='#' onclick='runJava(\"test\");'>Click Me</a>"]
];


function runJava(s){
alert(s);
}

var obj = new AW.UI.Grid;
obj.setCellText(myData);
obj.setColumnCount(1);
obj.setRowCount(1);
document.write(obj);
Alex (ActiveWidgets)
Friday, March 14, 2008

This topic is archived.


Back to support forum

Forum search