YigalB Posted January 22, 2011 Share Posted January 22, 2011 I would like to create HTML page with 10 buttons. Each button, when pressed, should execute a pre-defined PHP function. I know how to do it with forms, but I don't need any user input - just the button. I also need each button to have a pre-defined text on it, color and size. Some of them need to be grayed, until I finish the whole design - I plan to release the page with partial ability at first. I would appreciate simple example. Quote Link to comment Share on other sites More sharing options...
haku Posted January 22, 2011 Share Posted January 22, 2011 <a id="link1" href="file1.php">Php function 1</a> <a id="link1" href="file1.php">Php function 1</a> <a id="link1" href="file1.php">Php function 1</a> CSS: #link1 { background-color:red; color:white; } #link2 { background-color:blue; color:grey; } #link3 { background-color:yellow; color:pink } Quote Link to comment Share on other sites More sharing options...
YigalB Posted January 22, 2011 Author Share Posted January 22, 2011 Thank you! But.... since I am a newbie..and I don;t know yet how to integrate the CSS: do I need a separate file for CSS? can you show me a one file solution? Quote Link to comment Share on other sites More sharing options...
MattJG77 Posted January 24, 2011 Share Posted January 24, 2011 you should use CLASSES for multiple items sharing the same elements, and ID for single instances of an element. css styles should be kept in a separate file so multiple pages can access the same css over and over again. that way you only have to edit one file to affect your howl website. to creat a style sheet just copy everything between <style type="text/css"> and </style> and remove /*<![CDATA[*/ from the beginning and /*]]>*/ from the end. you can call the new style sheet file using the following code in replace. <link rel="stylesheet" href="styles.css" type="text/css" /> styles.css being the name you gave your new file. <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <title>Hello!</title> <style type="text/css"> /*<![CDATA[*/ .commonButtonElements { width: 100px; margin: 4px; cursor: pointer; } #button1 { background-color: #339966; color: #FFFFFF; } #button2 { background-color: #FF0066; } #button3 { background-color: #999999; } /*]]>*/ </style> </head> <body> <input type="button" name="field1" value="button1" class="commonButtonElements" id="button1"/> <input type="button" name="field2" value="button2" class="commonButtonElements" id="button2"/> <input type="button" name="field3" value="button3" class="commonButtonElements" id="button3"/> <input type="button" name="field4" value="button4" class="commonButtonElements" id="button4"/> <input type="button" name="field5" value="button5" class="commonButtonElements" id="button5"/> <input type="button" name="field6" value="button6" class="commonButtonElements" id="button6"/> <input type="button" name="field7" value="button7" class="commonButtonElements" id="button7"/> <input type="button" name="field8" value="button8" class="commonButtonElements" id="button8"/> <input type="button" name="field9" value="button9" class="commonButtonElements" id="button9"/> <input type="button" name="field10" value="button10" class="commonButtonElements" id="button10"/> </body> </html> Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.