How do I make a clickable button for a W5100 webserver?

I want to make a clickable button that will do something (open a txt file, turn a pin on/off) I haven't come across any good examples for the w5100 ethernet controller. I read this one: Arduino Tutorials - Ethernet+SD, but it seems a little complicated. I do like this example for the enc28j60:

#include "etherShield.h"
#include "ETHER_28J60.h"

int outputPin = 6;

static uint8_t mac[6] = {0x54, 0x55, 0x58, 0x10, 0x00, 0x24};   // this just needs to be unique for your network, 
static uint8_t ip[4] = {192, 168, 1, 15}; // IP address for the webserver

static uint16_t port = 80; // Use port 80 - the standard for HTTP

ETHER_28J60 e;

void setup()
  e.setup(mac, ip, port);
  pinMode(outputPin, OUTPUT);

void loop()
  char* params;
  if (params = e.serviceRequest())
    e.print("<h1><a href='/?led=off'>Arduino Web Remote</a></h1>");
    if (strcmp(params, "?led=on") == 0)
      digitalWrite(outputPin, HIGH);
      e.print("<a href='?led=off'><button style='border: 1px solid #ff0000; border-left: 10px solid #ff0000' type='button'>LED IS ON</button></a>");
    else if (strcmp(params, "?led=off") == 0)
      digitalWrite(outputPin, LOW);
      e.print("<a href='?led=on'><button style='border: 1px solid #000; border-left: 10px solid #000' type='button'>LED IS OFF</button></a>");

But I am unsure of how to make it compatible with the Ethernet.h library for the w5100, specifically the statement with "if (params = e.serviceRequest())". What does serviceRequest() do? Is there a similar command I can use that would work with Ethernet.h?

I want to make a clickable button

Mechanical button or virtual button like on a web page?

A virtual button on a web page.

Test code

//zoomkat 3-17-12
//simple button GET server code to control servo and arduino pin 5
//for use with IDE 1.0
//open serial monitor to see what the arduino receives
//use the \ slash to escape the " in the html 
//address will look like when submited
//for use with W5100 based ethernet shields
//Powering a servo from the arduino usually DOES NOT WORK.
//note that the below bug fix may be required

#include <SPI.h>
#include <Ethernet.h>

#include <Servo.h> 
Servo myservo;  // create servo object to control a servo 

byte mac[] = { 0xDE, 0xAD, 0xBE, 0xEF, 0xFE, 0xED }; //physical mac address
byte ip[] = { 192, 168, 1, 102 }; // ip in lan
byte gateway[] = { 192, 168, 1, 1 }; // internet access via router
byte subnet[] = { 255, 255, 255, 0 }; //subnet mask
EthernetServer server(84); //server port

String readString; 


void setup(){

  pinMode(5, OUTPUT); //pin selected to control
  //start Ethernet
  Ethernet.begin(mac, ip, gateway, subnet);

  myservo.write(90); //set initial servo position if desired
  myservo.attach(7);  //the pin for the servo co
  //enable serial data print 
  Serial.println("server LED test 1.0"); // so I can keep track of what is loaded

void loop(){
  // Create a client connection
  EthernetClient client = server.available();
  if (client) {
    while (client.connected()) {
      if (client.available()) {
        char c =;

        //read char by char HTTP request
        if (readString.length() < 100) {

          //store characters to string 
          readString += c; 

        //if HTTP request has ended
        if (c == '\n') {

          Serial.println(readString); //print to serial monitor for debuging 

          client.println("HTTP/1.1 200 OK"); //send new page
          client.println("Content-Type: text/html");

          client.println("<TITLE>Arduino GET test page</TITLE>");

          client.println("<H1>Zoomkat's simple Arduino button</H1>");
          // DIY buttons
          client.println("<a href=\"/?on\"\">ON</a>"); 
          client.println("<a href=\"/?off\"\">OFF</a>

          // mousedown buttons
<input type=\"button\" value=\"ON\" onmousedown=\"location.href ('/?on');\"/>"); 
          client.println("<input type=\"button\" value=\"OFF\" onmousedown=\"location.href ('/?off');\"/>");        
          // mousedown radio buttons

<input type=\"radio\" value=\"ON\" onmousedown=\"location.href ('/?on');\"\">ON</>"); 
          client.println("<input type=\"radio\" value=\"OFF\" onmousedown=\"location.href ('/?off');\"\">OFF</>");        
          //stopping client

          ///////////////////// control arduino pin
          if(readString.indexOf("on") >0)//checks for on
            digitalWrite(5, HIGH);    // set pin 5 high
            Serial.println("Led On");
          if(readString.indexOf("off") >0)//checks for off
            digitalWrite(5, LOW);    // set pin 5 low
            Serial.println("Led Off");
          //clearing string for next read



I had the same problem this week, but I rersolved my issue.
I assume you could host a webpage, but your question is to get a button not a hyperlink?

For a pin to turn for my code the arduino was waiting for a certain page to be accessed witch you specify, for a example: yourip/?on

so if this is the same senario for you here is the code for html for a clickable button to forward you to the specific page:

client.println("<button type='button' onclick=location.href='?on'>Turn LED On ");

note that ?on in my code is the page. so if you want pin off, use ?off depending on your code:

If you want to test more html code use this site: W3Schools Tryit Editor

If you need more help could ask me since I got it working connected to my router with port forwarding dyndns ect so I could with my mobile fone turn a pin on or of through the internet anywhere in the world where there is a internet availability.

Hope this help, let me know.

Thank you for the help! I was able to accomplish what I wanted to, but I am still curious about the serviceRequest() statement in the example I posted for the etherShield library: "if (params = e.serviceRequest())". Would someone please further explain what serviceRequest() does?