91
rated 0 times
[
98]
[
7]
/ answers: 1 / hits: 19945
/ 12 Years ago, sat, june 9, 2012, 12:00:00
I'm a newbie to scripting. I want to update HTML content with JavaScript, but as you can see
the web page keeps refreshing.
How can I prevent the page from refreshing?
Javascript:
function showResult(form) {
var coba=form.willbeshown.value;
var coba2=coba+2;
document.getElementById(showresulthere).innerHTML=coba2;
}
HTML
<form>
<input type=text name=willbeshown value=>
<button onclick=showResult(this.form)>Ganti1</button>
</form>
<p id=showresulthere>Result will be shown here</p>
</body>
More From » jquery