Re: HTML_PAGE and javascript [mispelling in code]

From: Date: Tue, 28 Oct 2003 17:18:24 +0000
Subject: Re: HTML_PAGE and javascript [mispelling in code]
References: 1  Groups: php.pear.general 
Request: Send a blank email to pear-general+get-8655@lists.php.net to get a copy of this message
Hi Roger, Thank for the reply, indeed I made a type. Now I have corrected it, and the name of the script is really the same as how it is referred in the php page. Still it's not working. Do you have a working example of how this is done ? I am not sure if it's the little mistakes I made that prevent it from working, or it is that I am doing in the wrong way. Thanks Ludi --- Roger Spears <roger@bgnet.bgsu.edu> wrote: --------------------------------- And I saved it as myJavascrip.js$p->addScript('myjavascript.js');In one part you have a capital J on javascript and no t. In the PEAR code you have a lowercase J and a t.That could be it....HTH,Roger Ludi Wang wrote: Hi All,I want to add a java script to my php page withHTML_PAGE.For example, I have this javascriptfunction 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 directoryas 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 thisfunction.Now when I open my php page, and view source, I seethis :<head> <title></title> <meta name="Generator" content="PEAR HTML_Page" /> <meta name="Author" content="" /> <style type="text/css"> </style> <scripttype="text/javascript"src="myjavascript.js"></script></head>When I click on the checkbox, I got message 'error onpage'. The script is fine. So what did I do wrong ?Anyone got an example of how to load java scirpt whileusing HTML_PAGE? Thanks in advance Ludi Wang__________________________________Do you Yahoo!?Exclusive Video Premiere - Britney Spearshttp://launch.yahoo.com/promos/britneyspear __________________________________ Do you Yahoo!? Exclusive Video Premiere - Britney Spears http://launch.yahoo.com/promos/britneyspears/

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