Exemplo n.º 1
0
<?php 
/**
 * HTML_Javascript::Javascript Sample usage
 *
 * Show how to use the base of HTML_Javascript
 *
 * @author Pierre-Alain Joye <*****@*****.**>
 * @package HTML_Javascript
 * @filesource
 */
/** requires the main class */
require_once 'HTML/Javascript.php';
$htmljs = new HTML_Javascript();
// Starts the JS script
echo $htmljs->startScript();
echo $htmljs->writeLine('<h2>document.write</h2>');
// document.write methods
/*
 * Simple usage of write and writeLine
 * See the confirm, prompt examples to see these methods
 * usage with JS variables.
 */
echo $htmljs->writeLine('writeln: Test JS Line 1', false);
echo $htmljs->write('write: Test JS Line 2', false);
echo $htmljs->write('write: Test JS still Line 2', false);
echo $htmljs->writeLine('<h2>Interaction with the users, prompt, alert and confirm</h2>');
echo $htmljs->alert('I will ask you three questions and write back the answers.');
// alert, confirm and prompt methods
/*
 * Yes/No Dialog box, be carefull, the 1st arg is the target JS variable.
 * We will certainly use the same argument order in futurs major releases