OLPCities/Button

From OLPC
< OLPCities
Revision as of 23:13, 13 February 2007 by Jacobolus (talk | contribs)
Jump to navigation Jump to search
The printable version is no longer supported and may have rendering errors. Please update your browser bookmarks and please use the default browser print function instead.

"Button" is a Class that is part of the DOM (Document Object Model). This "library" is referenced automaticaly by the browser of the OLPC station and you don't need to add anything in the program to use it.


To create an object of the Class you will use the tag INPUT defining a TYPE=BUTTON, NAME and a VALUE. We need to define a function for the event onClick. The object will be used in a chain of objects. Something like this will work :

<html>
<head>
<form name="form1">
<input type=text name="tb1">
<input type=button name="bt1" onClick="WriteHello()">
</form> 
<script language="Javascript">
function init(){
 document.form1.tb1.value ="Press the button!";
  
}
function WriteHello(){
 document.form1.tb1.value ="HelloWorld!";
 document.form1.bt1.value ="WOW!";
  
}

</script>
</head>
<title>TUTCity</title>
<center>
<body  bgcolor="yellow"  onload=init()>
 </center> 
</html>

Button.jpg

Properties

value [=String]                   

 
 

Link to the Classes: Document Form