Jump to content

Multi button page


YigalB

Recommended Posts

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.

Link to comment
Share on other sites

<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
}

 

Link to comment
Share on other sites

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>

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.