I'm having trouble combining two HTML/CSS and JS codes together.
The first snippet of code is a simple button that changes text on click:
<html>
<head>
<script type="text/javascript">
function myTest(btnID)
{
document.getElementById(btnID).value="After";
}
</script>
</head>
<body>
<input type="button" name="toggleBtn" id="toggleBtn" onclick="myTest('toggleBtn')" value="Before" >
Now, I want to merge it with the following JavaScript code:
<script type="text/JavaScript">
<!--
redirectTime = "5000";
redirectURL = "http://cpanel.hostinger.ae";
function timedRedirect() {
setTimeout("location.href = redirectURL;",redirectTime);
}
// -->
</script>
<div style="background-color:green;padding:5px;width:110px;cursor:pointer;"
onclick="JavaScript:timedRedirect()">
By M.A JS Code
</div>
Is there a way to make the button change text when clicked and then automatically redirect the page after a certain time?