RE: [PHP] Re: Embedding JavaScript into a PHP generated web page
| From: | Ash Young | Date: | Mon, 26 Jan 2004 01:21:03 +0000 |
| Subject: | RE: [PHP] Re: Embedding JavaScript into a PHP generated web page | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-191852@lists.php.net to get a copy of this message | ||
I'd suggest putting some new line characters in after the <!-- as it will
treat the JavaScript as a comment.
So just add a new line character at the end of each of the echo statements.
--
ash young :: http://evoluted.net/
-----Original Message-----
From: Robert Frame [mailto:Robert_M_Frame@verizon.net]
Sent: 26 July 2004 01:13
To: php-general@lists.php.net
Subject: [PHP] Re: Embedding JavaScript into a PHP generated web page
OK, now I am bewildered again.
Sample Code
<?php
echo '<script language="text/javascript">'; echo '<!-- ';
echo 'function
myWindow() { alert("javascript from php")}'; echo '//-->
</script>'; ?> ...
<html><body><form ....>
echo '<input type="submit" value="Window" name="Window"
onclick="myWindow();"> ';
</form></body></html>
As soon as I hit the button 'Window' I get an ''object expected" error.
Any thoughts?
Rob
"Robert Frame" <Robert_M_Frame@verizon.net> wrote in message
news:20040725210034.76809.qmail@pb1.pair.com...
> After I posted this I did some more searching on google and found the
> following code, which works.
>
> echo '<EOT><script language="javascript">function myWindow(){
> alert("javascript from php");}</script>';
>
> I then tried it without the <EOT> tag and it still worked. Apparently
> I
had
> something out of wack, probably a quote.
>
> Off hand though, can anyone tell me what <EOT> is?
>
> Thanks for the help.
> Rob
>
> "Robert Frame" <Robert_M_Frame@verizon.net> wrote in message
> news:20040725153214.12854.qmail@pb1.pair.com...
> > Hi There,
> >
> > I have a web page with a form that is generated by PHP, and part of
> > my design utilizes JavaScript to provide some error checking within
> > the
> objects
> > in the form. I have written the javascript in an html document, but
> > I
am
> > having trouble blending the two together.
> >
> > I have tried sending the javascript within an echo statement, as
> > well as using straight HTML/JavaScript code, but nothing seems to work.
> >
> > Can anyone offer some help or direct me to a solution?
> >
> > Thanks,
> > Rob
--
PHP General Mailing List (http://www.php.net/) To unsubscribe, visit:
http://www.php.net/unsub.php