Radio
Radio Du er her: /  Forsiden  /  Kildekoden  /  Form  /  Radio   Login nu   Login
Radio
 ««« Se kilde koden
Radio
Radio Basic Radio Radio Base Radio Radio Component Radio Radio Db Radio Radio Dto Radio Radio Form  Radio Radio Form-elements Radio Radio Jquery Radio Radio Layout Radio Radio Menu Radio Radio Menu-fisheye Radio Radio Mvc Radio Radio Tab Radio Radio Table Radio Radio Template Radio Radio Util Radio
Radio
Radio
Radio Index
 
Tilbage

Navn : Radio.php


Sample code, tutorial

Sådan benyttes komponenten Radio klassen

Først skal du inkludere den fil der beskriver komponenten, som en klasse fil

  • <?
    require_once(HTML_PACKAGE_PATH.'/Radio.php');
    ?>

Dernæst kan du enten benytte komponenten som et taglib (statiske metoder):

  • <?
    Radio
    ::display($param1, $param2, $param3, ...);
    ?>

eller du kan lave en instance af komponenten og benytte metoderne direkte:

  • <?
    $object
    = new Radio($param1, $param2, $param3, ...);
    print
    $object->getHtml();
    ?>

Parent html

Sådan vises komponenten Radio klassen



PHP source code

Den fulde PHP kildekode for Radio klassen

<?
/**
* @package form
* @filesource
* @see HTML_FORM_COMPONENT_PATH.'/Radio.php'
* @copyright (c) http://Finn-Rasmussen.com
* @license http://Finn-Rasmussen.com/license/ myPHP License conditions
* @author http://Finn-Rasmussen.com
* @version 1.10
* @since 22-feb-2007
*/

/**
* The required files
*/
require_once(HTML_FORM_COMPONENT_PATH.'/Input.php');

/**
* Generates an INPUT element for a form, which is a Radio control
* <code>
*    <input type="radio" name="$name" value="$value" title="$title" tabindex="" disabled="disabled"
*           class="$class" checked="$checked" onclick="alert('Hello')" accesskey="$accesskey" />
* Usage:
*   $radio = new Radio($name,$value,$class,$checked,$disabled,$onclick,$title,$tabindex,$accesskey);
*   print $radio->getHtml();
* Or
*   Radio::display($name,$value,$class,$checked,$disabled,$onclick,$title,$tabindex,$accesskey);
* </code>
* Note: If you use the onclick facility, then use double quotes outside, and use single quotes inside
* Example: Radio::display($name,$value,$class,$checked,$disabled,"alert('hei');");
* @package form
*/

class Radio extends Input {
   
/**
    * Constructor
    * @param String $name      The name
    * @param String $value     The value, if any
    * @param String $class     The class
    * @param String $checked   The checked, if present
    * @param String $disabled  The disabled
    * @param String $onclick   On click event for javascript
    * @param String $title     The tooltip
    * @param String $tabindex  The tabindex
    * @param String $accesskey The accesskey
    */
   
function Radio($name,$value='',$class='',$checked='',$disabled='',$onclick='',$title='',$tabindex='',$accesskey='') {
      
$aClass = $class!=''?$class:CSS_RADIO_CLASS;
      
$size      = $checked; // Use the size as a placeholder for the checked attribute
      
$maxlength = ''; // Not supported
      
$readonly  = ''; // Not supported
      
$aValue    = $value!=''?$value:'';
      if (
$aValue=='' && $onclick!='') {
        
$aValue = 'notUsed';
      }
      
$this->Input('radio',$name,$aValue,$aClass,$size,$maxlength,$disabled,$readonly,$onclick,$title,$tabindex,$accesskey);
   }

   
/**
    * Display html
    * <code>
    * Usage:
    *    Radio::display($name,$value,$class,$checked,$disabled,$onclick,$title,$tabindex,$accesskey);
    * </code>
    * @static
    * @param String $name      The name
    * @param String $value     The value, if any
    * @param String $class     The class
    * @param String $checked   The checked, if present
    * @param String $disabled  The disabled
    * @param String $onclick   On click event for javascript
    * @param String $title     The tooltip
    * @param String $tabindex  The tabindex
    * @param String $accesskey The accesskey
    */
   
function display($name='',$value='',$class='',$checked='',$disabled='',$onclick='',$title='',$tabindex='',$accesskey='') {
      
$html = new Radio($name,$value,$class,$checked,$disabled,$onclick,$title,$tabindex,$accesskey);
      
$html->addHtml();
   }
}
?>

HTML source code

Den fulde HTML kildekode for Radio klassen

<?
<input type="radio" name="Test" id="Radio48" class="baseBody" value="none" tabindex="1" /><label for="Radio48" accesskey="T" title="Accelerator key, use (Alt + T)">
    <
b><span class="baseColorDark">T</span>est</b>&nbsp; (Alt + T) </label><br />



?>

Class methods

Her er 'klasse metoderne' for Radio klassen:

  • object
  • getclassname
  • getmsg
  • addhtml
  • gethtml
  • tostring
  • getcachefilename
  • save
  • content
  • stop
  • html
  • setobject
  • set
  • get
  • getattribute
  • gettag
  • add
  • getsizeof
  • getelement
  • getelements
  • gettoogle
  • getmaximize
  • getminimize
  • newtriangle
  • display
  • showsource
  • element
  • getvalue
  • setid
  • setonfocus
  • setonblur
  • id
  • input
  • radio

Object vars

Her er 'objekt variable' for Radio klassen:

  • html =>
  • sql =>
  • elements => Array
  • sizeof => 1
  • name => Test
  • id => Radio48
  • value => none
  • class => baseBody
  • title =>
  • tabindex => 1
  • onclick =>
  • accesskey =>
  • onfocus =>
  • onblur =>
  • type => radio
  • size =>
  • maxlength =>
  • disabled =>
  • readonly =>
  • checked =>
  • debug => 1

Radio

Vis denne side på danmark

Vis denne side på Germany

Vis denne side på England

Vis denne side på France

Vis denne side på Italy

Vis denne side på Norge

Vis denne side på Sverige

Vis denne side på USA


 
Radio