I have a javascript function that adds table rows when a button is clicked.
when adding rows, in one of the cells it uses:
var linkCell = row.insertCell(1);
var elLink = document.createElement('a');
var href='http://www.domain.co.uk/';
elLink.href = href;
elLink.innerHTML = 'Choose Product '+i;
linkCell.appendChild(elLink);
to add a HTML a href to each row but I want to be able to used onClick rather than a href
I have tried:
var linkCell = row.insertCell(1);
var elLink = document.createElement('a');
var href='javascript:void(0);';
var onClick=window.open('/admin/chooseproduct.php?c='+i,'Popup','width=550,height=500,left=150,top=200,toolbar=1,status=1,');
elLink.href = href;
elLink.innerHTML = 'Choose Product '+i;
linkCell.appendChild(elLink);
but that does not open the popup window as it should - how can I do this?
elLink.onclick = onClick;