I am new to web programming but still trying to develop a website. I use HTML and JavaScript to get everything done, but I'm really stuck. After looking at a few examples online, I was able to create an OK / Cancel button. Now I'm trying to create the same type of button using CSS, because I do not want to write the same piece of code on every page. Can CSS be used for this purpose? If yes, can someone please show me how to do this?
This is the code I have for buttons, which, by the way, work just fine:
<html>
<body>
<script type="text/javascript">
if (confirm("Press 'OK' to leave the Eternity Test, or 'Cancel' if you want to stay: "))
{
window.location="http://google.com";
}
else
{
window.location= "http://www.myWebPage.com";
}
</script>
</body>
</html>
Thank.
source
share