<?php
class myHappyBox {
var $box_height = 100;
var $box_width = 100;
var $box_color = '#EC0000';
var $top = 150;
var $left = 200;
function myHappyBox(){
}
function setHeight($value){
$this->box_height=$value;
}
function setWidth($value){
$this->box_width=$value;
}
function setColor($value){
$this->box_color=$value;
}
function displayBox(){
echo sprintf('<div style="position: absolute;height:%spx;width:%spx;
background-color:%s;left:%s; top:%s">
</div>',$this->box_height,$this->box_width,
$this->box_color,$this->left, $this->top);
}
}
$box=new myHappyBox();
$box->displayBox();
?>
<html><title> draw box</title>
<body>
var $box_height = 100;<br>
var $box_width = 100;<br>
var $box_color = '#EC0000';<br>
</body></html>
|