Browser support:
Specifies a link to an external resource.
Syntax:
Methods that return the object:
The base interface, through which you can add new functionalities to the
link object, is the
HTMLLinkElement interface.
If you want to see the HTML objects by categories, please visit this
page .
HTML page for this element: link
Possible members:
Properties
Methods
Events
Style properties
attributes
Represents a collection of attribute nodes that belong to an element.
baseURI
Returns the base URL for the object.
behaviorUrns
Represents a collection of the Uniform Resource Names for all behaviors attached to an element.
canHaveChildren
Retrieves a Boolean value that indicates whether the element can contain child elements.
canHaveHTML
Retrieves a Boolean value that indicates whether the element can contain HTML formatted text.
charset
Sets or retrieves the character encoding of the document, a linked document or a script block.
className
Sets or retrieves the style class or classes that belong to the element.
currentStyle
Represents the computed style settings for an element.
dir
Sets or retrieves the text direction as related to the lang property.
disabled
Sets or retrieves the state of an object for user interaction.
href
Specifies or returns the location of the destination.
hreflang
Sets or retrieves the language of a linked resource or anchor element.
id
Sets or retrieves a unique identifier for the object.
isContentEditable
Returns a Boolean value that indicates whether the contents of the object are editable by the user.
isDisabled
Returns a Boolean value that indicates whether the object is disabled.
isMultiLine
Returns a Boolean value that indicates whether the contents of an element can be multiline or not.
isTextEdit
Returns a Boolean value that indicates whether the createTextRange method can be used for the element.
lang
Specifies or returns the language of the element.
media
Specifies or returns the media types for style definition.
name
Sets or retrieves the name of an element.
nextElementSibling
Returns a reference to the next child element of the current element's parent.
nextSibling
Returns a reference to the next child of the current element's parent.
nodeName
Returns the name of the current node.
nodeType
Returns an integer that indicates the type of the node.
nodeValue
Sets or returns the value of the current node.
outerHTML
Sets or retrieves the outer HTML content (the source code including the opening and closing tags) of an element.
outerText
Sets or returns the text content of an element including the text content of its descendants.
ownerDocument
Returns the document object that contains the current element.
parentElement
Returns the parent element of the object in the DOM hierarchy.
parentNode
Returns the parent element of the object in the DOM hierarchy.
parentTextEdit
Returns the closest ancestor element of the current element in the DOM hierarchy that can be used to create a TextRange object.
previousElementSibling
Returns a reference to the previous child element of the current element's parent.
previousSibling
Returns a reference to the previous node of the current element's parent.
readyState
Returns a string value that represents the state of the object.
rel
Specifies or returns the relationship between the current document and the destination of an anchor or link .
rev
Specifies or returns a reverse relationship from an anchor or link to the current document.
runtimeStyle
Represents the overridden style settings for an element.
scopeName
Retrieves the local name of the namespace declared for the current element.
sheet
Represents a CSS style sheet that belongs to a style element or an imported style file.
sourceIndex
Returns the position of the current object in the all collection of the document .
style
Represents the inline style settings for an element.
styleSheet
Represents a CSS style sheet that belongs to a style element or an imported style file.
tagName
Returns the tag name of the current element.
tagUrn
Sets or retrieves the Uniform Resource Name (URN) of the namespace declared for the current element.
target
Specifies or returns the target window or frame where the document is to be opened.
title
Specifies or returns a ToolTip for an object.
type
Specifies or returns the content type (MIME type) of the object or the linked object.
uniqueID
Returns the unique identifier generated by the browser for the object.
addBehavior
Attaches the specified behavior to the current element.
addEventListener
Registers an event handler function (event listener) for the specified event on the current object.
applyElement
Inserts the specified element as a child or parent of the current element.
attachEvent
Registers an event handler function (event listener) for the specified event on the current object.
clearAttributes
Clears all attributes from the current element, except the id , name , style , value and event attributes.
cloneNode
Returns an exact copy of the current node.
compareDocumentPosition
Compares the placement of the specified node with the current node in the DOM hierarchy.
detachEvent
Removes the specified event handler from the current element that was registered earlier with the attachEvent method.
dispatchEvent
Dispatches the specified event to the current element.
fireEvent
Initializes an event object and dispatches it to the current element.
getAdjacentText
Returns the contents of the TextNode located at the specified position relative to the current element.
getAttribute
Returns the value of the attribute with the specified name from the current element.
getAttributeNode
Returns the attribute node with the specified name from the current element.
getAttributeNodeNS
Returns the attribute node with the specified namespace and name from the current element.
getAttributeNS
Returns the value of the attribute with the specified namespace and name from the current element.
getExpression
Returns the dynamic expression for the specified DHTML property on the current element.
hasAttribute
Returns whether the current element has an attribute with the specified name or not.
hasAttributeNS
Returns whether the current element has an attribute with the specified namespace and name or not.
hasAttributes
Returns whether the current element has any attributes specified or not.
hasChildNodes
Returns whether the current node has any child nodes or not.
insertAdjacentElement
Inserts an element at the specified position relative to the current element.
insertAdjacentHTML
Inserts a HTML formatted text at the specified position relative to the current element.
insertAdjacentText
Creates a new TextNode from the specified text and inserts it at the specified position relative to the current element.
isEqualNode
Returns whether the current node is equal to the specified one.
isSameNode
Returns whether the current node is the same node as the specified one.
isSupported
Returns whether the specified DOM module and version is supported by the current node.
mergeAttributes
Copies all attributes and its values from the specified element to the current element.
normalize
Puts the subtree that belongs to the current node into a 'normalized' form.
removeAttribute
Removes the attribute with the specified name from the current element.
removeAttributeNode
Removes the specified attribute node from the current element.
removeAttributeNS
Removes the attribute with the specified namespace and name from the current element.
removeBehavior
Removes the specified behavior from the current element.
removeEventListener
Removes the specified event handler from the current element that was registered earlier with the addEventListener method.
removeExpression
Removes the dynamic expression from the specified DHTML property on the current element.
removeNode
Removes the current element with or without its children from the document tree.
replaceNode
Replaces the current element with the specified element.
setAttribute
Adds an attribute with the specified name and value to the current element.
setAttributeNode
Adds the specified attribute node to the current element.
setAttributeNodeNS
Adds the specified attribute node to the current element.
setAttributeNS
Adds an attribute with the specified namespace, name and value to the current element.
setExpression
Sets a dynamic expression for the specified DHTML property on the current element.
swapNode
Interchanges the positions of the current element and the specified element in the document hierarchy.
onerror
Fires when an error occurs while loading an external file.
onload
Occurs when an object has been loaded.
onpropertychange
Occurs every time when the value of an element's property is changed.
onreadystatechange
Occurs when the load state of the data that belongs to an element or a HTML document changes.
behavior
Sets or retrieves the URL of a behavior file.
cssText
Sets or retrieves the contents of a style declaration as a string.
hasLayout
Returns a Boolean value that indicates whether the object has layout or not.
length
Returns the number of properties that have been set in the current style object.
pixelBottom
Specifies or retrieves the value of the bottom style property, in pixels.
pixelHeight
Specifies or retrieves the value of the height style property, in pixels.
pixelLeft
Specifies or retrieves the value of the left style property, in pixels.
pixelRight
Specifies or retrieves the value of the right style property, in pixels.
pixelTop
Specifies or retrieves the value of the top style property, in pixels.
pixelWidth
Specifies or retrieves the value of the width style property, in pixels.
posBottom
Specifies or retrieves the value of the bottom style property as a floating-point number that specifies the value in the current unit type of the bottom property.
posHeight
Specifies or retrieves the value of the height style property as a floating-point number that specifies the value in the current unit type of the height property.
posLeft
Specifies or retrieves the value of the left style property as a floating-point number that specifies the value in the current unit type of the left property.
posRight
Specifies or retrieves the value of the right style property as a floating-point number that specifies the value in the current unit type of the right property.
posTop
Specifies or retrieves the value of the top style property as a floating-point number that specifies the value in the current unit type of the top property.
posWidth
Specifies or retrieves the value of the width style property as a floating-point number that specifies the value in the current unit type of the width property.
Example HTML code 1:
This example illustrates the use of the link element:
< head >
< link rel = "stylesheet" href = "style.css" type = "text/css" >
</ head >
body {
background-color : #FF0000 ;
}
Did you find this example helpful?
yes
no
Example HTML code 2:
This example shows how to tell the client browser that you offer a search plugin from HTML. If the search provider is currently installed, it will be selected in the drop down menu of the Instant Search box.
< head >
< link rel = "search" type = "application/opensearchdescription+xml"
href = "searchProvider.xml" title = "Dottoro Search" />
</ head >
< body >
Please open the search options of the Instant Search box in the menubar.
</ body >
<?xml version = "1.0" ?>
< OpenSearchDescription xmlns = "http://a9.com/-/spec/opensearch/1.1/" xmlns:moz = "http://www.mozilla.org/2006/browser/search/" >
<!-- a brief human-readable title that identifies the search engine -->
< ShortName > Dottoro </ ShortName >
<!-- a brief human-readable title that identifies the search engine -->
< LongName > Dottoro Search Engine </ LongName >
<!-- description of the search engine -->
< Description > Use Dottoro to search on dottoro.com </ Description >
<!-- an URL where the search requests can be handled -->
< Url type = "text/html" method = "get" template = "http://www.dottoro.com/search/search.php?search={searchTerms}" >
< Param name = "search" value = "{searchTerms}" />
</ Url >
<!-- the URL of the suggestions -->
< Url type = "application/x-suggestions+json" method = "get" template = "http://www.dottoro.com/search/suggestions.php?search={searchTerms}" />
<!-- e-mail where the description document can be reached -->
< Contact > search@dottoro.com </ Contact >
<!-- the image that is associated with the search engine -->
< Image height = "16" width = "16" type = "image/x-icon" > http://www.dottoro.com/favicon.ico </ Image >
<!-- character encoding of the search -->
< InputEncoding > UTF-8 </ InputEncoding >
<!-- the URL of the Search Home Page -->
< moz:SearchForm > http://www.dottoro.com/search.php </ moz:SearchForm >
</ OpenSearchDescription >
Did you find this example helpful?
yes
no
Related pages:
External links:
Share:
Digg
Del.icio.us
Reddit
Facebook
Twitter
Diigo
User Contributed Comments