Re: Link acting as a submit button

From: Date: Fri, 25 Jul 2003 00:44:31 +0000
Subject: Re: Link acting as a submit button
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-156773@lists.php.net to get a copy of this message
Warning for </SCRIPT>... It's also the ending for PHP you see... Shouldn't matter in this case, although, wouldn't suprise me at all if it was... -- // DvDmanDT MSN: dvdmandt@hotmail.com Mail: dvdmandt@telia.com "Matt Palermo" <mpalermo@vt.edu> skrev i meddelandet news:001001c35233$f6a89940$4400a8c0@laptop... > 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.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 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 > > > > >

« previous php.general (#156773) next »