OLPCities/TextBox: Difference between revisions

From OLPC
Jump to navigation Jump to search
No edit summary
No edit summary
 
(3 intermediate revisions by 2 users not shown)
Line 1: Line 1:
"TextBox" 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.
"TextBox" 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.


We are now (sept 2006) doing tests to verify all the methods and properties of this Class that is working OK with the OLPC station. So, we have only a few elements presented here.
To create an object of the Class you will use the <b>tag</b> INPUT defining a TYPE=TEXT, NAME and a SIZE . Eventually: VALUE. The default SIZE is 20 characters. The object will be used in a chain of objects. Something like this will work :

To create an object of the Class you will use the <b>tag</b> INPUT defining a TYPE=TEXT, NAME and a SIZE . Something like:
<pre>
<pre>
<html>
<input type=text name=tb1>
<head>
<form name="form1">
<input type=text name="tb1">
</form>
<script language="Javascript">
function init(){
document.form1.tb1.value ="Hello World!";
}
</script>
</head>
<title>TUTCity</title>
<center>
<body bgcolor="yellow" onload=init()>
</center>
</html>

</pre>
</pre>

[[Image: Textbox.jpg]]


==Properties==
==Properties==
<pre>
<pre>
value The String inside the text box.
value [=String] Is R/w .The String inside the text box.
By example: we can capture what was typed at a textbox with:
By example: we can capture what was typed at a textbox with:
document.form1.tb1.value
document.form1.tb1.value (or towrite it, like in the example)


size [=n]


</pre>
</pre>


Link to the Classes:[[Document]] [[Form]]
Link to the Classes:[[OLPCities/Document|Document]] [[OLPCities/Form|Form]]


[[Category:OLPCities]]
[[Category:OLPCities_JavaScript_Libraries]]

Latest revision as of 00:23, 14 February 2007

"TextBox" 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=TEXT, NAME and a SIZE . Eventually: VALUE. The default SIZE is 20 characters. 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">
</form> 
<script language="Javascript">
function init(){
 document.form1.tb1.value ="Hello World!";  
}
</script>
</head>
<title>TUTCity</title>
<center>
<body  bgcolor="yellow"  onload=init()>
 </center> 
</html>

Textbox.jpg

Properties

value [=String]                  Is R/w .The String inside the text box.
                                 By example: we can capture what was typed at a textbox  with:
                                 document.form1.tb1.value (or towrite it, like in the example)

size  [=n]

 

Link to the Classes:Document Form