473,386 Members | 1,799 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,386 software developers and data experts.

Simple Remove text from attribute value

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
2 3313
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
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 thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

4
by: scorpion | last post by:
I have a simple type like this: <xs:simpleType name="SizeType"> <xs:restriction base="xs:token"> <xs:enumeration value="small"/> <xs:enumeration value="medium"/> <xs:enumeration...
2
by: Claudio Jolowicz | last post by:
How can XSLT stylesheets be used to edit, remove and add nodes specified by their position in the document tree? The XML document stores development tasks in a hierarchical way, i.e. tasks can...
14
by: Brandon | last post by:
I am an amateur working on a first site, I have settled on using FP 2002 for now. My current page is up and live, but I have two errors that I cant seem to get rid of ... Line 29, column 6:...
3
by: Marc Llenas | last post by:
Hi there, I'm stuck on a validation function for a form and I cannot figure out what the problem is. The page is in ASP. Any ideas? The function being called is: <script...
11
by: greg.scharlemann | last post by:
I've been playing with this form validation method for a while and have tried an array of things but haven't had any luck with a couple items. 1. The validateForm() function doesn't detect when...
8
by: rdavis7408 | last post by:
I am attempting what I would think would be a simple calculation of the cost of traveling a single mile. But I can not figure this out. The following is my script. Any help would be appreciated. ...
7
by: db | last post by:
Hi@all Just got a comparison problem with javascript. I want to compare : document.getElementById(currentID).getAttribute("style") with a string, e.g: "background-color: lightgreen;" They...
3
by: P2000 | last post by:
I want to make a regex for the replace function that will replace any "a" with "A" and any "b" with "B". This is what I did so far... (I'm trying to learn this RegEx thing) <form> <input...
4
by: N9 | last post by:
Hi I had a xslt that parse a XML document, output is HTML But XSLT adding not valid code: <ul class="level_1" xmlns="" xmlns:xsi="http://www.w3.org/2001/ XMLSchema-instance"> I had try...
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.