Google Groups Home
Help | Sign in
Message from discussion Link acting as a submit button
The group you are posting to is a Usenet group. Messages posted to this group will make your email address visible to anyone on the Internet.
Your reply message has not been sent.
Your post was successful
 
From:
To:
Cc:
Followup To:
Add Cc | Add Followup-to | Edit Subject
Subject:
Validation:
For verification purposes please type the characters you see in the picture below or the numbers you hear by clicking the accessibility icon. Listen and type the numbers you hear
 
Matt Palermo  
View profile  
 More options Jul 24 2003, 7:15 pm
Newsgroups: php.general
From: mpale...@vt.edu (Matt Palermo)
Date: Thu, 24 Jul 2003 18:35:56 -0400
Local: Thurs, Jul 24 2003 6:35 pm
Subject: 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.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


    Reply to author    Forward  
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.

Create a group - Google Groups - Google Home - Terms of Service - Privacy Policy
©2009 Google