[PHP] Embedding JavaScript into a PHP generated web page
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
[PHP] Re: Embedding JavaScript into a PHP generated web page
After I posted this I did some more searching on google and found the following code, which works. echo 'function myWindow(){ alert("javascript from php");}'; I then tried it without the tag and it still worked. Apparently I had something out of wack, probably a quote. Off hand though, can anyone tell me what is? Thanks for the help. Rob "Robert Frame" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] > 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
[PHP] Re: Embedding JavaScript into a PHP generated web page
OK, now I am bewildered again. Sample Code '; echo ' '; ?> ... echo ' '; As soon as I hit the button 'Window' I get an ''object expected" error. Any thoughts? Rob "Robert Frame" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] > After I posted this I did some more searching on google and found the > following code, which works. > > echo 'function myWindow(){ > alert("javascript from php");}'; > > I then tried it without the tag and it still worked. Apparently I had > something out of wack, probably a quote. > > Off hand though, can anyone tell me what is? > > Thanks for the help. > Rob > > "Robert Frame" <[EMAIL PROTECTED]> wrote in message > news:[EMAIL PROTECTED] > > 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
Re: [PHP] Re: Embedding JavaScript into a PHP generated web page
Thanks Ash, you were on to the right solution. Because there is no newline character, there is nothing ending the JavaScript line. I had to add a ';' prior to the single quote ending the echo line. Each statement now looks like echo 'Info = new Array(4);'; Or to add a bit more code: '; echo 'Info = new Array(4);'; for (i=0; i<4; i++) {Force_Info[i] = new Array(9);}'; ?> Thanks for the help, Rob "Ash Young" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] > I'd suggest putting some new line characters in after the ash young :: http://evoluted.net/ > > -Original Message- > From: Robert Frame [mailto:[EMAIL PROTECTED] > Sent: 26 July 2004 01:13 > To: [EMAIL PROTECTED] > Subject: [PHP] Re: Embedding JavaScript into a PHP generated web page > > OK, now I am bewildered again. > > Sample Code > > > echo ''; echo '<!-- '; echo 'function > myWindow() { alert("javascript from php")}'; echo '//--> '; ?> ... > > echo ' onclick="myWindow();"> '; > > > As soon as I hit the button 'Window' I get an ''object expected" error. > > Any thoughts? > Rob > > "Robert Frame" <[EMAIL PROTECTED]> wrote in message > news:[EMAIL PROTECTED] > > After I posted this I did some more searching on google and found the > > following code, which works. > > > > echo 'function myWindow(){ > > alert("javascript from php");}'; > > > > I then tried it without the tag and it still worked. Apparently > > I > had > > something out of wack, probably a quote. > > > > Off hand though, can anyone tell me what is? > > > > Thanks for the help. > > Rob > > > > "Robert Frame" <[EMAIL PROTECTED]> wrote in message > > news:[EMAIL PROTECTED] > > > 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 -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Easy Question (I think)
I am sure this is an obvious answer, but dang if I could find it. How do you chop off a decimal value in PHP? I know I can do it using a combination of modulus, subtraction and division, but isn't there a function that does this? I think I am suffering from a giant mental block =) -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Sending PHP to different targeted frames
I've created a web page utilizing 3 frames (header, index, main). In the frame named 'main' I have a form setup for logging into a MySQL database. On a successful login I want to change the html in 'index' and 'main'. The active frame 'main' is easy, as the new html code will go into this window by default. However, how do I load html into the index frame? If there is a different way to handle this, please feel free to share them. Thanks -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php