Re: HTML_PAGE and javascript [mispelling in code]
| From: | Ludi Wang | Date: | Wed, 29 Oct 2003 15:44:57 +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-8683@lists.php.net to get a copy of this message | ||
I figured it out. It's
$p->addScript("myJavascript.js");
It works great, now I can have any number of pages
pointing to one javascript file. The error I had was
caused by an error inside the javascript itself.
Thanks for the response anyway.
--- Roger Spears <roger@bgnet.bgsu.edu> wrote:
---------------------------------
I'm not familiar with that PEAR function what so
ever. I do usejavascript in my php stuff, but never
with PEAR. Never really had theneed.
Sorry,
Roger
Ludi Wang wrote:
Hi Roger,Thank for the reply, indeed I made a type.
Now I havecorrected it, and the name of the script is
really thesame 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 thatprevent it from working, or it is
that I am doing inthe wrong way.Thanks Ludi--- Roger
Spears <roger@bgnet.bgsu.edu>
wrote:--------------------------------- And I saved
it asmyJavascrip.js$p->addScript('myjavascript.js');In
onepart you have a capital J on javascript and no t.
Inthe PEAR code you have a lowercase J and a
t.Thatcould be it....HTH,RogerLudi Wang wrote: Hi
All,I want to add a java script to my php
pagewithHTML_PAGE.For example, I have
thisjavascriptfunction CheckAll() { for
(vari=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
savedit as myJavascrip.js in the same directoryas
where myphp page is. Then in my php page I say:$p =
newHTML_Page();$p->addScript('myjavascript.js');TheonClick
even of a checkbox is set to callthisfunction.Now when
I open my php page, and viewsource, I seethis :<head>
<title></title> <metaname="Generator" content="PEAR
HTML_Page" /> <metaname="Author" content="" /> <style
type="text/css"></style><scripttype="text/javascript"src="myjavascript.js"></script></head>WhenI
click on the checkbox, I got message 'error
onpage'.The script is fine. So what did I do wrong
?Anyone gotan example of how to load java scirpt
whileusingHTML_PAGE? Thanks in advance
LudiWang__________________________________Do
youYahoo!?Exclusive Video Premiere -
BritneySpearshttp://launch.yahoo.com/promos/britneyspear
__________________________________Do you
Yahoo!?Exclusive Video Premiere - Britney
Spearshttp://launch.yahoo.com/promos/britneyspears/
-- Roger SpearsTechnology Project CoordinatorCollege
of Arts and SciencesBowling Green State
UniversityBowling Green, Ohio 43403VOICE: (419)
372-2015FAX: (419) 372-8548
__________________________________
Do you Yahoo!?
Exclusive Video Premiere - Britney Spears
http://launch.yahoo.com/promos/britneyspears/