Exemplo n.º 1
0
<?php

/**
* A file intended for testing output direction in the HTML_Javascript class
*/
require_once 'HTML/Javascript.php';
$js = new HTML_Javascript();
$js->setOutputMode(HTML_JAVASCRIPT_OUTPUT_FILE, '/tmp/out.js');
$js->prompt('Foo?', 'foo', 'Bar!');
$js->alert('Muhahaha!');
Exemplo n.º 2
0
<html>
<body>
<?php 
//ini_set('include_path','.:/data/peartest/share/pear');
//ini_set('include_path','.:/data/pear/cvsroot/pear:/data/pear/cvsroot/php4/pear');
require_once 'HTML/Javascript.php';
require_once 'HTML/Javascript/Convert.php';
// ,array(741,742,743)
$test = array("foo1" => "this \\ is a string test &\" and 'nothing' must failed", "foo2" => 2, "foo3" => 3, "foo4" => 4, "foo5" => 5, "foo6" => 6, "foo7" => array(71, 72, 73, "foo74" => array(741, 742, 743)));
$js = new HTML_Javascript();
echo $js->startScript();
echo HTML_Javascript_Convert::convertArray($test, 'arTest', true);
echo HTML_Javascript::alert('toto');
echo HTML_Javascript::prompt('toto', 'toto');
echo $js->confirm('sure', 'Are you sure?!');
echo $js->popup('win', './test.html', 'window', 200, 200, false);
echo $js->popupWrite('win2', 'Foo? Bar!', 'window2222222222222222222222', 200, 200, true);
echo $js->endScript();
?>
<script>


function interrogate(what) {
    var output = '';
    for (var i in what){
        output += i+ " ";
    }
    alert(output);
}

</script>
Exemplo n.º 3
0
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
 * in the dialog box, the 2nd is the name of the JS variable to store the return value
 */
echo $htmljs->prompt('What is your favourite langage?', 'favouritelangage');
echo $htmljs->write('What is your favourite langage? Your answer:');
echo $htmljs->writeLine('favouritelangage', true);
/**
 * So you like popups?
 */
echo $htmljs->popup('popup_page1', 'page1.html', 'HTML_Javascript_page1', 400, 300, false);
$popupContent = '<html>
<head>
<title>HTML_Javascript popupWrite Usage</title>
</head>
<body>
<h1>HTML_Javascript::popupWrite</h1>
This is a popup with dynamic content<br>
</body>
</html>