473,473 Members | 2,031 Online
Bytes | Software Development & Data Engineering Community
Create Post

Home Posts Topics Members FAQ

Removing NAME attritbute

I've been given a large number of HTML pages. Each page has one or more
tags. When the pages were being built I asked that an ID attribute be
included with each element that will later be referenced. The first
ID'ed element on the page has the ID 'item0', the next 'item1' and so on.

Unfortunately they also included a NAME element which in many cases is
similar to the ID but out by one. That is the first element on the page
has the NAME 'item1', the next 'item2' and so on.

This stuffs up some things that depend on the ID (IE seems to make use
of the NAME instead of the ID when I ask getElementByID). Is there an
"easy" way to remove all the NAME attributes, or at least make them
invisible to IE, on page load?

Andrew Poulos
May 24 '06 #1
2 1143
VK

Andrew Poulos wrote:
Is there an
"easy" way to remove all the NAME attributes, or at least make them
invisible to IE, on page load?


You may iterate through document.all collection and
removeAttribute('NAME'). I don't know if IE supports the mask
document.getElementsByTagName("*") // all elements
but you can try also. Yet you cannot kill every single NAME on the page
as it breaks form submission (if presented), you need to check element
type before removal.

May 24 '06 #2
Andrew Poulos wrote:
I've been given a large number of HTML pages. Each page has one or more
tags. When the pages were being built I asked that an ID attribute be
included with each element that will later be referenced. The first
ID'ed element on the page has the ID 'item0', the next 'item1' and so on.

Unfortunately they also included a NAME element which in many cases is
similar to the ID but out by one. That is the first element on the page
has the NAME 'item1', the next 'item2' and so on.

This stuffs up some things that depend on the ID (IE seems to make use
of the NAME instead of the ID when I ask getElementByID).


I'd be curious to see exactly how it breaks. In my experience, IE uses
NAME if the desired ID does not exist. So if you had 10 elements, (ID's
item0..item9, NAMEs item1..item10), you would only experience a problem
with item10.
May 24 '06 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

3
by: Walter Zydhek | last post by:
I am having a problem using the NameValueCollection type. If I remove one of the items while iterating through an collection of this type, I end up with an exception. This exception is:...
0
by: scott | last post by:
Below, I'm trying to remove the querystring name& value of "catID=12". I mananged to isolate the RESULTS part, but I need to be able to strip the querystring name and it's value, no matter if the...
1
by: Maziar Aflatoun | last post by:
Hello, I have a string variable that contains XML data with many different namespaces. I like to remove all the namespaces from my XML (clean the XML). What's the quickest way to do this? Ex....
1
by: THDWWSIJQUOK | last post by:
I have (or should I say "had") a module which I invested quite a few hours of work into. I was poking around trying to rename the module and instead wound up removing the darn thing. It's been a...
0
by: sameer mowade via .NET 247 | last post by:
Hello All, I have problem while dynamically removing row from the Datagrid which i have added dynamically as shown in the following code snippet. The problem is that while removing dynamically...
7
by: Simon Hart | last post by:
Hi, I have a requirement to remove the xmlns from the DOM in order to pass over to MS CRM 3.0 Fetch method.It seems the fetch method blows up if there is a xmlns present!?! The reason I have a...
6
by: Chris Chiasson | last post by:
Hi, After reading and experimenting for a several hours, I have this stylesheet: <?xml version="1.0" encoding="UTF-8"?> <xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"...
7
by: =?Utf-8?B?Sm9lbCBNZXJr?= | last post by:
I have created a custom class with both value type members and reference type members. I then have another custom class which inherits from a generic list of my first class. This custom listneeds...
2
code green
by: code green | last post by:
I am trying to write a simple function that will take a string containing an address line or business name and return it nicely formatted. By this I mean extra spaces removed and words capitalised....
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
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...
1
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
1
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...
0
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...
0
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
0
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated ...

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.