OLPCities/Document: Difference between revisions
Jump to navigation
Jump to search
No edit summary |
No edit summary |
||
(6 intermediate revisions by 2 users not shown) | |||
Line 1: | Line 1: | ||
"Document" 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. |
"Document" 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. |
|||
You don't need to create any object for this Class because it will have only one stantialization for a page. You will use the "prefix": <b>document</b> to call its elements. |
You don't need to create any object for this Class because it will have only one stantialization for a page. You will use the "prefix": <b>document</b> to call its elements. |
||
==Methods== |
|||
<pre> |
|||
write(String) String can be HTML tags. It's commomly used to write dynamically a page. |
|||
</pre> |
|||
==Properties== |
==Properties== |
||
Line 18: | Line 24: | ||
(object of the Class Form) Normaly we have a chain of objects, because a property of the |
(object of the Class Form) Normaly we have a chain of objects, because a property of the |
||
Class Form can be an object of the Class |
Class Form can be an object of the Class TextBox etc. |
||
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 |
||
bgColor = Color define the background color of the page. |
|||
</pre> |
</pre> |
||
Link to the Classes: [[Form |
Link to the Classes: [[OLPCities/Form|Form]] |
||
[[Category:OLPCities]] |
|||
[[Category:OLPCities_JavaScript_Libraries]] |
Latest revision as of 23:40, 13 February 2007
"Document" 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.
You don't need to create any object for this Class because it will have only one stantialization for a page. You will use the "prefix": document to call its elements.
Methods
write(String) String can be HTML tags. It's commomly used to write dynamically a page.
Properties
cookie [= String] Is R/W. Used to write or read a cookie. The String is: "name-of-cookie = value; expires=expiration-date" An example, of code, reading the data from a textbox to a cookie "dynamic1"; then = new Date(); then.setTime(then.getTime() + 60*60*1000) //cookie available one hour document.cookie = "dynamic1="+document.form1.tb1.value+";expires="+then.toGMTString(); (object of the Class Form) Normaly we have a chain of objects, because a property of the Class Form can be an object of the Class TextBox etc. By example: we can capture what was typed at a textbox with: document.form1.tb1.value bgColor = Color define the background color of the page.
Link to the Classes: Form