E
Eric Mitchell
Hello all,
I am using the document.write() method to create new content on the same
page, however... I need to create a new button using this method (button in
HTML). Complicating the matter worse, I have a javascript function that
needs to be called in the onClick event of the button. Is there any way of
doing this? Here is my code, which gives me an error because the function is
read as an object, and there is no object...
<script language="javascript">
function firstFunction(){
var buttonType="<input type=button value=Proceed name=contOn
onclick=secondFunction();>"
document.write(buttonType);
}
function secondFunction(){
document.write("Test string");
}
</script>
The first function (firstFunction()) is initiated by a button later in the
code that I didn't feel was necessary to provide. However, as you can see in
the third line of code, in the onClick method of the button... JavaScript
reads secondFunction() as an object, not a function. How can I fix this?
Thank you!
-Eric
I am using the document.write() method to create new content on the same
page, however... I need to create a new button using this method (button in
HTML). Complicating the matter worse, I have a javascript function that
needs to be called in the onClick event of the button. Is there any way of
doing this? Here is my code, which gives me an error because the function is
read as an object, and there is no object...
<script language="javascript">
function firstFunction(){
var buttonType="<input type=button value=Proceed name=contOn
onclick=secondFunction();>"
document.write(buttonType);
}
function secondFunction(){
document.write("Test string");
}
</script>
The first function (firstFunction()) is initiated by a button later in the
code that I didn't feel was necessary to provide. However, as you can see in
the third line of code, in the onClick method of the button... JavaScript
reads secondFunction() as an object, not a function. How can I fix this?
Thank you!
-Eric