HTML_PAGE and javascript ?

From: Date: Tue, 28 Oct 2003 16:45:18 +0000
Subject: HTML_PAGE and javascript ?
Groups: php.pear.general 
Request: Send a blank email to pear-general+get-8653@lists.php.net to get a copy of this message
Hi All, I want to add a java script to my php page with HTML_PAGE. For example, I have this javascript function CheckAll() { for (var i=1;i<document.Myform.elements.length;i++) { var e = document.Myform.elements[i]; if (e.name != 'allbox') e.checked = document.Myform.allbox.checked; } } And I saved it as myJavascrip.js in the same directory as where my php page is. Then in my php page I say: $p = new HTML_Page(); $p->addScript('myjavascript.js'); The onClick even of a checkbox is set to call this function. Now when I open my php page, and view source, I see this : <head> <title></title> <meta name="Generator" content="PEAR HTML_Page" /> <meta name="Author" content="" /> <style type="text/css"> </style> <script type="text/javascript"src="myjavascript.js"></script> </head> When I click on the checkbox, I got message 'error on page'. The script is fine. So what did I do wrong ? Anyone got an example of how to load java scirpt while using HTML_PAGE? Thanks in advance Ludi Wang __________________________________ Do you Yahoo!? Exclusive Video Premiere - Britney Spears http://launch.yahoo.com/promos/britneyspears/

« previous php.pear.general (#8653) next »