473,750 Members | 2,265 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

"name" attribute...... .more than one use?

<a href="#" name="sample">l ink 1</a>
<a href="#" name="sample">l ink 2</a>

Would this be invalid use of the name?
If I wanted to have a function that would be acted upon by detection of the
"name", would this happen if all "name"s in a group were the same?
I know ID can only be used once per document, what about "name"?

If this is invalid, then if I went by a unique ID, such as sample1, sample2,
sampl3, is there a way to eliminate the number on the end to check if the
strings match what I'm looking for?

For those of you familiar with ancient BASIC, we could easily do this by
saying something like A$=left$(b$,6).
Where A$ would return the first 6 characters of b$.
So does JS have an equivelant?
Jul 23 '05 #1
6 1355
Lee
Richard said:

<a href="#" name="sample">l ink 1</a>
<a href="#" name="sample">l ink 2</a>

Would this be invalid use of the name?
If I wanted to have a function that would be acted upon by detection of the
"name", would this happen if all "name"s in a group were the same?
I know ID can only be used once per document, what about "name"?
The name attribute does not have to be unique.
Your use is valid.

If this is invalid, then if I went by a unique ID, such as sample1, sample2,
sampl3, is there a way to eliminate the number on the end to check if the
strings match what I'm looking for?

For those of you familiar with ancient BASIC, we could easily do this by
saying something like A$=left$(b$,6).
Where A$ would return the first 6 characters of b$.
So does JS have an equivelant?


A=b.substr(0,6)

Jul 23 '05 #2
On 15 Jan 2005 19:43:42 -0800 Lee wrote:
Richard said:
<a href="#" name="sample">l ink 1</a>
<a href="#" name="sample">l ink 2</a> Would this be invalid use of the name?
If I wanted to have a function that would be acted upon by detection of
the
"name", would this happen if all "name"s in a group were the same?
I know ID can only be used once per document, what about "name"? The name attribute does not have to be unique.
Your use is valid.
If this is invalid, then if I went by a unique ID, such as sample1,
sample2,
sampl3, is there a way to eliminate the number on the end to check if
the
strings match what I'm looking for? For those of you familiar with ancient BASIC, we could easily do this
by
saying something like A$=left$(b$,6).
Where A$ would return the first 6 characters of b$.
So does JS have an equivelant?

A=b.substr(0,6)

Thank you. I thought it must have.
Jul 23 '05 #3
Richard wrote:
<a href="#" name="sample">l ink 1</a>
<a href="#" name="sample">l ink 2</a>

Would this be invalid use of the name?
Yes - read the spec. In regard to <a> tags:

"This attribute names the current anchor so that it may be the
destination of another link. The value of this attribute must be a
unique anchor name. The scope of this name is the current document.
Note that this attribute shares the same name space as the id
attribute."

<URL:http://www.w3.org/TR/html4/struct/links.html#adef-name-A>

All tag attributes and the tags that they apply to, along with links
to explainations of each are here:

<URL:http://www.w3.org/TR/html4/index/attributes.html >

Whenever you are tempted to ask a question such as that above, read the
spec first.

If I wanted to have a function that would be acted upon by detection of the
"name", would this happen if all "name"s in a group were the same?
I know ID can only be used once per document, what about "name"?


Sometimes name must be unique, sometimes is should not be used and
sometimes it is mandatory. Check the specification each time you want
to use it.

--
Rob
Jul 23 '05 #4
Lee wrote:
Richard said:
<a href="#" name="sample">l ink 1</a>
<a href="#" name="sample">l ink 2</a>
[...]
The name attribute does not have to be unique.
Your use is valid.


Wrong. In regard to named links, the name attribute *must* be unique
and it shares the same namespace as ID, so it must not match an ID
either.

--
Fred
Jul 23 '05 #5
On Sun, 16 Jan 2005 14:48:37 +1000 RobG wrote:
Richard wrote:
<a href="#" name="sample">l ink 1</a>
<a href="#" name="sample">l ink 2</a> Would this be invalid use of the name?
Yes - read the spec. In regard to <a> tags: "This attribute names the current anchor so that it may be the
destination of another link. The value of this attribute must be a
unique anchor name. The scope of this name is the current
document.
Note that this attribute shares the same name space as the id
attribute." <URL:http://www.w3.org/TR/html4/struct/links.html#adef-name-A> All tag attributes and the tags that they apply to, along with links
to explainations of each are here: <URL:http://www.w3.org/TR/html4/index/attributes.html > Whenever you are tempted to ask a question such as that above, read
the
spec first.

I would if I knew how w3 was structured to find these things out.
Like they make it so easy.
I thought it had to be unique but I wasn't sure if that was correct or not.
Jul 23 '05 #6
Richard wrote:
[...]
Whenever you are tempted to ask a question such as that above, read
the
spec first.


I would if I knew how w3 was structured to find these things out.
Like they make it so easy.
I thought it had to be unique but I wasn't sure if that was correct or not.


Here is the start of the W3C HTML 4.01 spec. It is the table of
contents and has links to everything to do with HTML.

<URL:http://www.w3.org/TR/html4/>

At the bottom are links to references, notably a list of all the
elements and all the attributes.

The only way to get to know it is to start using it - think of an
element, say <p> and look it up, it's in chapter 9, titled:

"Text - Paragraphs, Lines, and Phrases"

Click the link, it takes you here:

<URL:http://www.w3.org/TR/html4/struct/text.html>

Or, to go via the Index of elements, go to the bottom of the table of
contents (where references are normally listed), and click on the link
to here:

<URL:http://www.w3.org/TR/html4/index/elements.html>

scroll down to "P", click on it and you go here:

<URL:http://www.w3.org/TR/html4/struct/text.html#edef-P>

Now you know how I use it, try it.
--
Rob.
Jul 23 '05 #7

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

Similar topics

6
3263
by: Jochen Daum | last post by:
Hi ! If I have an input field <form ... method="post"> <input type="text" name="abc def"> </form>
4
2243
by: Dan Jacobson | last post by:
Using <A name="x_y-z"></A>, I even get nervous about the _ and -. w3-recs/RECS/html4/struct/links.html seems to say all of ascii is cool and beyond. Anyway, just what is the safe range for characters in a name="" ? I don't plan to go beyond usual Unix filename chars.
6
2316
by: Java script Dude | last post by:
We just discovered another IE bug. When an html form contains an element with a name of `name` IE's internal index screws up the .name property of the containing form to point to the bad element object instead of containing the string name property of the form. Here is the simplified test case: <html>
3
2706
by: Pavils Jurjans | last post by:
Hello, I have bumped upon this problem: I do some client-side form processing with JavaScript, and for this I loop over all the forms in the document. In order to identify them, I read their "name" property (which sources from "name" HTML attribue). The problem is, that if the form contains form control named "name", it overwrites the form name property. In fact, I'm quite surprised that it's so easy to spoil any of the form object...
6
1495
by: Just Me | last post by:
My Task List contains the following: At least one reference is missing the 'Name' attribute. Any suggestion on how toe find which project is missing it? Solution contains 25 projects. Thanks
4
4651
by: ajschuster | last post by:
I cannot get my Javascript to work in Firefox. I am just trying to access the .name property of a DIV tag but it keeps coming back as "undefined". The same code works in IE and it works in Safari.... and if I change it to .id instead of .name it can read that so why wouldn't it be able to read the .name? I need urgent help!! Here's my code....
5
1792
by: Alex Maghen | last post by:
The editor says that when using <a name="xyz" />, the "name" element is "obsolete" but it doesn't suggest a replacement. What's wrong with <a name="xyz" /> to set a page anchor?
6
2310
by: Dick Watson | last post by:
I had a page that works when setup like this: === <form name="frmCalc" action=""> <script type="text/javascript"> function btnCalc_onclick(abc) { return "got here with " + abc; }
3
1457
by: idorjee | last post by:
Hi, Can anyone please tell me if there is a way to hyperlink to a web page which doesn't have the anchor "name" attribute (e.g., <a name="thename">), but has tags such as, <strong>. So, my question is, is it possible to hyperlink to a tag? The only way that I know is the following: <a href="http://thepage.com/example.html#thename">The Web Link</a> Thanks a lot in advance.
0
9000
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, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
9577
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
9396
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 tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
9339
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 Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
9256
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
8260
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, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
0
6081
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 then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
4887
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
3322
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 we have to send another system

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.