* The following script gives value of javascript into php file
* @email zeesh...@yahoo.com
* @auther zeeshan
* @copyright Copyright © 2005, Zeeshan
*/
class javascript{
function prompt($m,$d=0){
$msg = "<script>a = prompt(\"$m\",$d);document.write(a);</script>";
return $msg;
}
function alert($a){
$msg = "<script>alert(\"$a\");</script>";
return $msg;
}
function confirm($a){
$msg = "<script>c = confirm(\"$a\");document.write(c);</script>";
return $msg;
}
function php2jscript($a,$window="alert"){
if($window=="alert") $wind="alert";
if($window=="confirm") $wind="confirm";
if($window=="prompt") $wind="prompt";
$msg = "<script>c = $wind(\"$p\");document.write(c);</script>";
return $msg;
}
}// end class javascript
/////////////////////////////////////////////////////////////////////
// usage for javascript to php;
$j = new javascript();
$a = $j->prompt("Input",23);
echo $j->alert("hello");
$c = $j->confirm("sure?");
echo " hello $a $c";
// usage for php to javascript;
$param = "hello";
echo $j->php2jscript($param,'prompt');
?>