Class NAJAX_HTML

Description

NAJAX HTML Class.

This class is used to update the content and the style of a page.

Example:

  1. <?php
  2.  
  3. class Update
  4. {
  5. function ui()
  6. {
  7. sleep(1);
  8.  
  9. $content =& NAJAX_HTML::getElementById('content');
  10.  
  11. $content->innerHTML = 'Hello World! How are you?';
  12. }
  13. }
  14.  
  15. define('NAJAX_AUTOHANDLE', true);
  16.  
  17. require_once('najax.php');
  18.  
  19. ?>
  20. <?= NAJAX_Utilities::header('.') ?>
  21.  
  22. <div id="content">Hello!</div>
  23.  
  24. <script type="text/javascript">
  25.  
  26. var obj = <?= NAJAX_Client::register(new Update()) ?>;
  27.  
  28. obj.ui(najax.asyncCall);
  29.  
  30. </script>

  • version: 0.4.1.0
  • author: Stanimir Angeloff

Located in /extensions/html/classes/HTML.class.php (line 141)


	
			
Method Summary
object The &addScriptBlock (string $script)
object The &getElementById (string $id)
object The &getElementsByName (string $name)
object The &getElementsByTagName (string $tagName)
void importForm (string $id, string $formData)
string process ()
Methods
addScriptBlock (line 273)

Adds a given JavaScript code to the output.

Note that you must use the '&' operator in order to get a reference to the script block.

You should add ';' at the end of the script.

Example:

  1. NAJAX_HTML::addScriptBlock('alert("Hello World!");');

  • return: DOM element that represents the script block.
  • static:
  • access: public
object The &addScriptBlock (string $script)
  • string $script: JavaScript source code.
getElementById (line 165)

Returns the element whose ID is specified.

Note that you must use the '&' operator in order to get a reference to the element.

Example:

  1. $content =& NAJAX_HTML::getElementById('content');

  • return: DOM element with the specified ID. Note that the server has no idea whether the element exists on the client or not.
  • static:
  • access: public
object The &getElementById (string $id)
  • string $id: String representing the unique id of the element being sought.
getElementsByName (line 202)

Returns an object representing a list of elements of a given name in the document.

Note that you must use the '&' operator in order to get a reference to the list.

Example:

  1. $messages =& NAJAX_HTML::getElementsByName('message');

  • return: DOM elements list with the specified name. Note that the server has no idea whether any elements exists on the client or not.
  • static:
  • access: public
object The &getElementsByName (string $name)
  • string $name: String representing the value of the name attribute on the element.
getElementsByTagName (line 239)

Returns an object representing a list of elements of a given tag name in the document.

Note that you must use the '&' operator in order to get a reference to the list.

Example:

  1. $inputs =& NAJAX_HTML::getElementsByTagName('input');

  • return: DOM elements list with the specified tag name. Note that the server has no idea whether any elements exists on the client or not.
  • static:
  • access: public
object The &getElementsByTagName (string $tagName)
  • string $tagName: String representing the name of the tag on the element.
importForm (line 307)

Imports an associative array to the corresponding form elements.

Example:

  1. NAJAX_HTML::importForm('mainForm', array('firstName' => 'First', 'lastName' => 'Last'));

  • static:
  • access: public
void importForm (string $id, string $formData)
  • string $id: The client ID of the form.
  • string $formData: Associative array that contains the values to import.
process (line 331)

Returns the JavaScript code of all DOM elements.

You should not call this method directly.

  • return: JavaScript source code for each DOM element or null if no DOM elements were created.
  • static:
  • access: public
string process ()

Documentation generated on Tue, 20 Sep 2005 21:40:04 +0300 by phpDocumentor 1.3.0RC3