* @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 * of HTML_Javascript ($str, as a 1st argument). * The result (boolean) is stored in a JS variable given as a 2nd arg, here likehtmljs */ echo $htmljs->confirm('likehtmljs', 'Do you like HTML_Javascript?'); echo $htmljs->write('Do you like HTML_Javascript? Your answer:'); echo $htmljs->writeLine('likehtmljs', true); /* * Ask a value, works exactly as confirm. The 1st argument is the string to write