Why does my javascript button dissapear onlick(in-line method) -
I know some javascript but it does not quite understand why this code disappears.
& lt; Input type = "button" name = "clickable" value = "click me!" Onclick = "clicked ();" & Gt;
OR
& lt; Button onclick = "clicked ();" & Gt; Clicks & lt; / Button & gt;
This is my function
clicked the function () {document.write ("thank you"); }
As you can see, this element is not going to hide or tell anything like that. Can anyone explain this? One solution would be good.
document.write overwrites the existing HTML page. You can try something like this:
script:
clicked the function () {document.getElementById ('myOutput'). InnerHTML = "Thank you"; }
HTML:
& lt; Input type = "button" name = "clickable" value = "click me!" Onclick = "clicked ();" & Gt; & Lt; Div id = "myOutput" & gt; & Lt; / Div & gt;
Comments
Post a Comment