This is a discussion on RE: [PHP] Link acting as a submit button within the PHP General forums, part of the PHP Programming Forums category; I just remembered (I'm not sure if it makes a difference) that I am using frames on this page. ...
|
|||||||
| FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read |
|
|||
|
I just remembered (I'm not sure if it makes a difference) that I am using
frames on this page. Does this matter at all? Thanks. Matt >===== Original Message From Matt Palermo <mpalermo@vt.edu> ===== >Fixing the javascript that you specified still gave me the same >errors... Got any more suggestions? > >Thanks for your help, > >Matt > >-----Original Message----- >From: Jim Lucas [mailto:phplist@zonedzero.net] >Sent: Thursday, July 24, 2003 6:40 PM >To: Matt Palermo >Subject: Re: [php] Link acting as a submit button > >Your javascript is wrong. > >change this > document.forms[0].action = where; >to this > document.forms[0].action.value = where; > >Jim Lucas > >----- Original Message ----- >From: "Matt Palermo" <mpalermo@vt.edu> >To: <php-general@lists.php.net> >Sent: Thursday, July 24, 2003 3:35 PM >Subject: [php] Link acting as a submit button > > >> I am trying to create a submit button out of a hyperlink using the >> following >> code: >> >> (this is in a file called index.html) >> <A href="javascript:go_where_my_variable_says('this.p hp');">this >> page</a> >> >> >> <SCRIPT LANGUAGE="JavaScript"> >> <!-- >> function go_where_my_variable_says(where) >> { >> document.forms[0].action = where; >> document.forms[0].submit(); >> } >> //--> >> </SCRIPT> >> >> This works fine as an html document, however, when I try to echo the >> same code >> out in a PHP page, it gives me javascript errors. I am using the >> following to >> echo it out in PHP: >> >> echo " >> <A href=\"javascript:go_where_my_variable_says('this. php');\">this >> page</a> >> >> >> <SCRIPT LANGUAGE=\"JavaScript\"> >> <!-- >> function go_where_my_variable_says(where) >> { >> document.forms[0].action = where; >> document.forms[0].submit(); >> } >> //--> >> </SCRIPT> >> "; >> >> This displays the link fine for the submit hyperlink, but it gives the > >> javascript error: >> >> Error: Object doesn't support this property or method. >> Code: 0 >> >> Like I said before, this code works perfectly fine if I have it an >html >> document. >> >> Anyone got any ideas? >> >> Thanks, >> Matt >> >> >> >> >> > > > > >-- >PHP General Mailing List (http://www.php.net/) >To unsubscribe, visit: http://www.php.net/unsub.php |
|
|||
|
On Fri, 2003-07-25 at 05:30, Matt Palermo wrote:
> I just remembered (I'm not sure if it makes a difference) that I am using > frames on this page. Does this matter at all? Thanks. Yes it matters tons with the javascript call. Here is some info on it...however, these questions are now javascript and not php... 1. make sure you pass in a valid page to your function. 2. make sure that you have a form that you are accessing. 3. make sure that when you access the form you are accessing the correct frame page. Example: when you set up the frames use the name attribute to assign names to the frames... so if you have a frame named frame1...then you can do this... frame1.document.forms[0].action.value = where; frame1.document.forms[0].submit; I might be off on this a little but that should get you started in the right direction. -- BigDog |
|
|||
|
Depends, are you trying access the form from a different frame?
Jim Lucas ----- Original Message ----- From: "Matt Palermo" <mpalermo@vt.edu> To: "Jim Lucas" <phplist@zonedzero.net>; "Matt Palermo" <mpalermo@vt.edu>; "php-general" <php-general@lists.php.net> Sent: Friday, July 25, 2003 4:30 AM Subject: RE: [php] Link acting as a submit button > I just remembered (I'm not sure if it makes a difference) that I am using > frames on this page. Does this matter at all? Thanks. > > Matt > > > > >===== Original Message From Matt Palermo <mpalermo@vt.edu> ===== > >Fixing the javascript that you specified still gave me the same > >errors... Got any more suggestions? > > > >Thanks for your help, > > > >Matt > > > >-----Original Message----- > >From: Jim Lucas [mailto:phplist@zonedzero.net] > >Sent: Thursday, July 24, 2003 6:40 PM > >To: Matt Palermo > >Subject: Re: [php] Link acting as a submit button > > > >Your javascript is wrong. > > > >change this > > document.forms[0].action = where; > >to this > > document.forms[0].action.value = where; > > > >Jim Lucas > > > >----- Original Message ----- > >From: "Matt Palermo" <mpalermo@vt.edu> > >To: <php-general@lists.php.net> > >Sent: Thursday, July 24, 2003 3:35 PM > >Subject: [php] Link acting as a submit button > > > > > >> I am trying to create a submit button out of a hyperlink using the > >> following > >> code: > >> > >> (this is in a file called index.html) > >> <A href="javascript:go_where_my_variable_says('this.p hp');">this > >> page</a> > >> > >> > >> <SCRIPT LANGUAGE="JavaScript"> > >> <!-- > >> function go_where_my_variable_says(where) > >> { > >> document.forms[0].action = where; > >> document.forms[0].submit(); > >> } > >> //--> > >> </SCRIPT> > >> > >> This works fine as an html document, however, when I try to echo the > >> same code > >> out in a PHP page, it gives me javascript errors. I am using the > >> following to > >> echo it out in PHP: > >> > >> echo " > >> <A href=\"javascript:go_where_my_variable_says('this. php');\">this > >> page</a> > >> > >> > >> <SCRIPT LANGUAGE=\"JavaScript\"> > >> <!-- > >> function go_where_my_variable_says(where) > >> { > >> document.forms[0].action = where; > >> document.forms[0].submit(); > >> } > >> //--> > >> </SCRIPT> > >> "; > >> > >> This displays the link fine for the submit hyperlink, but it gives the > > > >> javascript error: > >> > >> Error: Object doesn't support this property or method. > >> Code: 0 > >> > >> Like I said before, this code works perfectly fine if I have it an > >html > >> document. > >> > >> Anyone got any ideas? > >> > >> Thanks, > >> Matt > >> > >> > >> > >> > >> > > > > > > > > > >-- > >PHP General Mailing List (http://www.php.net/) > >To unsubscribe, visit: http://www.php.net/unsub.php > > > |