By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
459,521 Members | 1,252 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 459,521 IT Pros & Developers. It's quick & easy.

Simple Remove text from attribute value

P: n/a
This is a snippet from my page:

<form name="form1" method="post" action="Default.aspx?id=365272"
id="form1" enctype="multipart/form-data">

I need some javascript that can check if the id query string is in the
action attribute, and if it is, remove it so the form element will look
like this:

<form name="form1" method="post" action="Default.aspx" id="form1"
enctype="multipart/form-data">

Thanks.

Oct 6 '06 #1
Share this Question
Share on Google+
2 Replies


P: n/a
Lee
eg****@gmail.com said:
>
This is a snippet from my page:

<form name="form1" method="post" action="Default.aspx?id=365272"
id="form1" enctype="multipart/form-data">

I need some javascript that can check if the id query string is in the
action attribute, and if it is, remove it so the form element will look
like this:

<form name="form1" method="post" action="Default.aspx" id="form1"
enctype="multipart/form-data">
No, what you want is to replace the action attribute value with
the current value with anything after and including a "?" removed.

off the top of my head, that's
document.form1.action=document.form1.action.replac e(/\?.*/,"");
--

Oct 6 '06 #2

P: n/a
Thanks,

I'm doing this and it works:

document.form1.action='default.aspx';
Lee wrote:
eg****@gmail.com said:

This is a snippet from my page:

<form name="form1" method="post" action="Default.aspx?id=365272"
id="form1" enctype="multipart/form-data">

I need some javascript that can check if the id query string is in the
action attribute, and if it is, remove it so the form element will look
like this:

<form name="form1" method="post" action="Default.aspx" id="form1"
enctype="multipart/form-data">

No, what you want is to replace the action attribute value with
the current value with anything after and including a "?" removed.

off the top of my head, that's
document.form1.action=document.form1.action.replac e(/\?.*/,"");
--
Oct 6 '06 #3

This discussion thread is closed

Replies have been disabled for this discussion.