What's new
HTML Forums | An HTML and CSS Coding Community

Welcome to HTMLForums; home of web development discussion! Please sign in or register your free account to get involved. Once registered you will be able to connect with other members, send and receive private messages, reply to topics and create your very own. Our registration process is hassle-free and takes no time at all!

on click button not working. Could you please help me in identifying the bug

Kiriti

New member
<!DOCTYPE html>
<html>
<head>
<title>program 1a</title>
</head>
<body style="background-color:green">
<h2>when you click on press me it will change text</h2>
<p id="Demo">Gokaraju</p>
<button onclick="Change text()">click me
</button>
<script>
function "Change text()"
{
if(document.getElementById("Demo").innerHTML="Gokaraju");
{
document.getElementById("Demo").innerHTML="2nd CSE A");
}
else
{
document.getElementById("Demo").innerHTML="Siva";
}
}
</script>
</body>
</html>
 
Back
Top