Having HEAD section like that:
<head>
<title>Foo</title>
<meta http-equiv="Content-Type"
content="text/html; charset=iso-8859-1">
<link
title="linkObje ct"
rel="Alternate Appendix"
type="text/plain"
href="data.txt"
charset="iso-8859-1"
hreflang="en-US">
</head>
what would be the most realible way to get "linkObject " reference?
var roof = document.getEle mentsByTagName( 'HEAD')[0];
// ? 5 2799
VK wrote: Having HEAD section like that:
<head>
<title>Foo</title> <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<link title="linkObje ct" rel="Alternate Appendix" type="text/plain" href="data.txt" charset="iso-8859-1" hreflang="en-US">
</head>
what would be the most realible way to get "linkObject " reference?
var roof = document.getEle mentsByTagName( 'HEAD')[0]; // ?
Replacing `title=' with `id=' and using Document::getEl ementById().
PointedEars
Thomas 'PointedEars' Lahn wrote: Replacing `title=' with `id=' and using Document::getEl ementById().
Are ID's formally allowed for LINK? Or for other elements in the
non-rendering section (HEAD) I did not find this attribute listed
neither in W3C nor in MSDN. From the other side TITLE is required by
W3C for alternate content links.
Not to say I technically care too much but for some reasons I want to
have this LINK usage free of any "hacking model" accusations. Unusual -
yes, but fully standard compliant.
VK wrote: Thomas 'PointedEars' Lahn wrote: Replacing `title=' with `id=' and using Document::getEl ementById(). Are ID's formally allowed for LINK? Or for other elements in the non-rendering section (HEAD) I did not find this attribute listed neither in W3C nor in MSDN.
You must have a different "W3C" and "MSDN" than I have ;-)
The `id' attribute is allowed for "All elements but BASE,
HEAD, HTML, META, SCRIPT, STYLE, TITLE".
See <URL:http://www.w3.org/TR/html4/index/attributes.html >
,-<URL:http://msdn.microsoft. com/workshop/author/dhtml/reference/properties/id.asp>
|
| Applies To
| [...] LABEL, LEGEND, LI, LINK, LISTING, [...]
^^^^
The (X)HTML DTDs clearly state the `link' element has the `id' attribute:
<URL:http://www.w3.org/TR/REC-html32#link>
<http://www.w3.org/TR/html4/struct/links.html#edef-LINK>
(note the `%attrs;' entity reference and follow the links
<URL:http://www.w3.org/TR/html4/sgml/dtd.html#attrs>
<URL:http://www.w3.org/TR/html4/sgml/dtd.html#coreat trs>)
<URL:https://www.cs.tcd.ie/15445/15445.html#DTD>
(search for "ATTLIST link")
<URL:http://www.w3.org/TR/xhtml1/dtds.html#dtden try_xhtml1-strict.dtd_link >
(search for "ATTLIST link", note the `%attrs;' entity reference and follow
the links)
The `title' attribute, however, should provide for a short description of
the element.
<URL:http://www.w3.org/TR/html4/struct/global.html#ade f-title>
From the other side TITLE is required by W3C for alternate content links.
How do you got that idea?
<URL:http://www.w3.org/TR/html4/struct/links.html#h-12.3.3>
Not to say I technically care too much
But you should, for your own sake and that of users of your content.
but for some reasons I want to have this LINK usage free of any "hacking model" accusations. Unusual - yes, but fully standard compliant.
Accessing the `id' attribute value is sufficiently un"hack"ish :)
PointedEars
function getElementByAtt ribute(tagn,att rib,str){
var A=document.getE lementsByTagNam e(tagn);
var O;
var L=A.length;
for(var i=0;i<L;i++){
var tem=A[i];
if(tem.getAttri bute(attrib)&& tem.getAttribut e(attrib)==str) {
O=tem;
break;
}
}
return O;
}
function getElementsByAt tribute(tagn,at trib,str){
var A=document.getE lementsByTagNam e(tagn);
var O=new Array();;
var L=A.length;
for(var i=0;i<L;i++){
var tem=A[i];
if(tem.getAttri bute(attrib)){
if(str) tem.getAttribut e(attrib)==str) O.push(tem);
else O.push(tem);
}
return O;
}
// In your case you can call: getElementsByAt tribute('link', 'title',str)
(str is whatever you want to match) This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics |
by: VK |
last post by:
I have this code failing to work in IE: getElementsByTagName doesn't
return elements from my JS namespace. What's wrong?
<html xmlns:js>
<head>
<title>Que</title>
<meta http-equiv="Content-Type" content="text/html;
charset=iso-8859-1">
|
by: Shwetabh |
last post by:
Hi,
This is a question asked to me in an interview.
I haven't been able to figure out an answer for
it. Please try to see what can be done about the
following problem.
/* I have been given two structures */
struct node
{
struct node *next;
|
by: Sergey Morkovkin |
last post by:
Hi, guys!
Does anyone knows the resolution of a problem when i need to insert <link> or <script> tag into HEAD section dynamically?
I was trying few ways to do this: 1) RegisterClientScriptBlock inserts script right after form.
2) RegisterStartupScript inserts script before post form.
3) Page.Controls.Add(new LiteralControl("<LINK rel='stylesheet' href='include/inputbox.css' type='text/css'>")); (or AddAt method) Works, but inserts only the...
|
by: Dave |
last post by:
Is there a way to dynamically add a reference to the css stylesheet from the
codebehind similarly to the script registration features?
I was thinking of adding this code to a base class and inherit all my pages
from it so the css link below is added to each page automatically in the
<head> section....
<LINK href="/MyApp/Css/MyApp.css" type="text/css" rel="stylesheet">
Thanks, Dave.
|
by: usenet |
last post by:
Hello,
I am running my code on an embedded platform without OS. I have defined some
data in a section called .eeprom. The section is defined by the linker
script and starts at address zero. The symbol __eeprom_end is defined by the
linker script as well, and lies at the end of this section. The address of
__eeprom_end is thus equal to the number of bytes in the .eeprom section.
My problem : I want to declare an array in .bss with the...
| |
by: Viken Karaguesian |
last post by:
Hello all,
I'm making a calendar section in a website. Each month is its own page and
navigated by Previous / Next links. I have it working now with standard
hyperlinks, but I want to learn how to use Link Rel and Link Rev commands to
do the navigation.
At the W3C website it shows how to use the Link Rel and Link Rev in the
<head> section:
|
by: Mike |
last post by:
Hi all,
In my recent ASP.NET 2.0 appl, I need to verify that the supplied email address is valid or not. So, here's my situation:
- In my <profilearea, I created <isVerifiedproperty.
- Suppose a new user has been created. I set the profile.isverified to false.
OnCreatedUser event I'll send him an email (to the supplied email address) to verify their email address with a link in it to an ASPX page that'll do the verification, e.g:...
|
by: =?Utf-8?B?amVmZjMxMTYy?= |
last post by:
Hi all
Is there a way to add a LINK rel="stylesheet" href="StyleSheet1.css"
type="text/css" tag to the header of each page at run time, rather than
having to copy and paste it into the html view of every new form as we create
them?
I would use a base page probably, just not sure how to add the code and get
it into the header section of the outgoing html
|
by: Nospam |
last post by:
I am trying to open a link in a new template window :
<a onclick="windowopen('example.html','example');return false;"
href="http://www.example.com" target="_blank"example link</a>
such that clicking on the example link will open it in a new window in an
already saved template/site/ called example.html
|
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 effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it.
First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
|
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...
| |
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,...
|
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...
|
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 presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules.
He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms.
Adolph will...
|
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();...
|
by: adsilva |
last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
|
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: muto222 |
last post by:
How can i add a mobile payment intergratation into php mysql website.
| |