not able to call Javascript Function from button onclick
I have following JS Code. When test.php is loaded and I click on button show function is not getting called.I am trying this on FF. Any suggestions what is wrong here.
test.php
<script type="text/javascript" src="http://localhost/test1.js"></script>
<script type="text/javascript" src="http://localhost/test2.js"></script>
test1.js
function show()
{
alert("hello");
}
test2.js
function showHTML()
{
var html = "<!DOCTYPE html>";
html += "<html><body>";
html += "<input type='button' name='button' style='width:100px;height:50px;' onclick='show();' />";
html += "</body></html>";
document.write(html);
}
showHTML();
I have following JS Code. When test.php is loaded and I click on button show function is not getting called.I am trying this on FF. Any suggestions what is wrong here.
test.php
<script type="text/javascript" src="http://localhost/test1.js"></script>
<script type="text/javascript" src="http://localhost/test2.js"></script>
test1.js
function show()
{
alert("hello");
}
test2.js
function showHTML()
{
var html = "<!DOCTYPE html>";
html += "<html><body>";
html += "<input type='button' name='button' style='width:100px;height:50px;' onclick='show();' />";
html += "</body></html>";
document.write(html);
}
showHTML();
No comments:
Post a Comment