Dynamic button in php

The site works on Bitrix, you need to make a dynamic button with three positions:

  1. rest state
  2. mouseover state
  3. state at time of click

All the info I can find is about CSS only. Thanks to everyone who responds!


Answer 1, authority 100%

PHP is not a markup language, and you can’t make an interface with it.
Dig into JavaScript and CSS.


Answer 2, authority 100%

Why don’t you like CSS tools? If the site is not designed for iOS and Android, then pseudo-classes normally solve your problem.

a:link    { color: red }    /*    */
a:visited { color: blue }   /*     */
a:hover   { color: yellow } /*       */
a:active  { color: lime }   /*      */

Answer 3, authority 75%

Here is an elementary example:

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
"http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<title></title>
<style>
#button{
absolute;
top: 5px;
left: 5px;
width: 60px;
height: 20px;
text-align: center;
background-color: #FFFF00;
border-radius: 5px;
}
</style>
</head>
<body>
<div id="button"></div>
<script>
var button=document.getElementById("button");
button.onmouseover=function(){button.style.backgroundColor="#FF00FF";}
button.onmouseout=function(){button.style.backgroundColor="#FFFF00";}
button.onmousedown=function(){button.style.backgroundColor="#FF0000";}
</script>
</body>
</html>

Leave a reply

Please enter your comment!
Please enter your name here