Using onclick function in javascript tags

shortieking

New Member
I have a function openWindow(word) that gets called when a button is clicked. This function opens a new window, prints the word and shows a button called do. The openWindow function works up until the onclick in its tag is supposed to find the do function. My problem is that onclick never seems to find my do function. What do I do?My do function:\[code\] function do() { alert("Life is what you make of it"); }\[/code\]My openWindow function: \[code\] function openWindow(word) { myWindow.document.write(word); myWindow.document.write('<body>'); myWindow.document.write('<input type="button" value="http://stackoverflow.com/questions/15819100/Do" onclick="do()">'); myWindow.document.write('</body>'); } }\[/code\]My html code to open window:\[code\]<body> <input type="button" value="http://stackoverflow.com/questions/15819100/Submit" onclick="openWindow()"></body>\[/code\]
 
Back
Top