LyndonOHRC
Programmer
I have an ajax driven form. After a selection is made and the form elements are populated I need to dynamically set the onclick behavior of a div. My approach (if there's an easier way I'm listening) is to set the div's innerHTML to the following:
Of course that fails because of the quotes... I've been trying to construct the contents but keep getting errors. Usually "Expected )" or "Expected ;". Here is how I thought it would work:
Thanks in advance
Lyndon
---People Remember about 10% of what you say ---They never forget how you made them feel. Covey
Code:
document.getElementById('DMWinXfer').innerHTML='<span onclick="alert('my message')">Click Here</span>';
Code:
document.getElementById('DMWinXfer').innerHTML='<span onclick=+'"'+'alert('+"'"+'my message+"'"+');'+'"'+'>Click Here</span>';
Thanks in advance
Lyndon
---People Remember about 10% of what you say ---They never forget how you made them feel. Covey