Avatar of sakthikumar
sakthikumar

asked on 

Java script, button disappears after clicked.

Hi

I am new to java script to HTML. Below is my code.
which displays a button. Problem is the button disappears after the execution onclick function.

Can you help me to fix this.

<html>
<head>
<title> My first java script program </title>
<style type="text/css">
    #play_button {
    position:absolute;
   
    top: 50px;
    left: 200px;
   
}
 </style>
</head>
<script type = "text/javascript">
function addnumbers(x,y){
var x = x+y;
return x;
}
function printnumbers(){
var x = addnumbers(12,23);
document.write(x);
}
//document.write(addnumbers(1,2));
</script>
<Form>
<div id = "play_button" >
<input  type = "button" value="click" onclick = "printnumbers(); return false;"></input>
</div>
</Form>
</html>
JavaScriptHTML

Avatar of undefined
Last Comment
Julian Hansen

8/22/2022 - Mon