PHP Classes

File: example_accesskeys.php

Recommend this page to a friend!
  Classes of Thiemo Kreuz   TM::Apeform   example_accesskeys.php   Download  
File: example_accesskeys.php
Role: Example script
Content type: text/plain
Description: How to automatically create accesskey attributes
Class: TM::Apeform
A very abstract web form builder and processor
Author: By
Last change: Accessible without user login
Date: 14 years ago
Size: 1,351 bytes
 

Contents

Class file image Download
<?php

/**
 * Accesskeys example. Shows mixed use of user defined and automatically created
 * accesskey attributes.
 *
 * @author Thiemo Mättig (http://maettig.com/)
 */

require_once("Apeform.class.php");
$form = new Apeform();

$form->autoAccesskeys = true;
$form->templates['accesskey'] = '<em class="accesskey">{accesskey}</em>';

$form->header("Some example");
$form->staticText("Some example", "", "Some example");
$form->text("Some example");
$form->password("User defined <u>k</u>ey");
$form->error("Error message inherits accesskey");
$form->textarea("Other example");
$form->checkbox("Some example");
$form->checkbox("", "", "Some example");
$form->checkbox("Some example", "", "Some example");
$form->checkbox("Some example", "", "Aaa|Bbb|Ccc");
$form->radio("Some example", "", "Aaa|Bbb|Ccc");
$form->select("Some example", "", "Aaa|Bbb|Ccc");
$form->submit("Submit accesskey example");

?>

<style type="text/css">
label{
    background-color:#FEC;
    cursor:hand;
}
label:hover{
    background-color:#FD0;
}
.accesskey{
    background-color:#FD0;
    color:#900;
    font-style:normal;
    font-weight:bold;
    text-decoration:underline;
}
</style>

<?$form->display()?>

<ul>
<li>In Internet Explorer and Firefox press Alt+character.</li>
<li>In Opera press Shift+Esc and then the character.</li>
</ul>