button and selectbox

Links for php scripts

Moderators: egami, macek, gesf

Post Reply
seandisanti
php-forum Fan User
php-forum Fan User
Posts: 973
Joined: Mon Oct 01, 2012 12:32 pm

Tue Mar 12, 2013 8:30 am

Jquery can do what you're looking for relatively easily. here's a little example of using a button to modify a paragraph. I'll leave using a select box to specify allowable style options as an exercise for you, but http://www.w3schools.com/jquery/ has all of the tutorials you need

Code: Select all

<!DOCTYPE html>
<html>
<head>
<script src="//ajax.googleapis.com/ajax/libs/jquery/1.9.1/jquery.min.js">
</script>
<script>
$(document).ready(function(){
  $("button").click(function(){
    $("p").css("color","red");
    $("p").css("font-weight","bold");
    $("p").css("font-size","2em");
  });
});
</script>
</head>

<body>
<button>Click to make text larger and red</button>
<br><br>
</body>
</html>


seandisanti
php-forum Fan User
php-forum Fan User
Posts: 973
Joined: Mon Oct 01, 2012 12:32 pm

Wed Mar 13, 2013 7:58 am

Show the code that you've already got

Post Reply