See also: addAttribute, setAttribute, deleteAttribute

Parses a query string to find the value associated with the attribute.

Syntax

JSV_getAttribute(expQ, attribute [, caseSensitive])

Prototype

expQ.getAttribute(attribute [, caseSensitive])

Returns

The value of the attribute.

Parameters

The getAttribute function uses the following arguments.

Argument Description
expQ The query string (e.g., ?ABC=123&L=Page1&Music=R%26B) that is to be parsed.
attribute The attribute name in the query string whose value is to be obtained.
caseSensitive Optional. Boolean value that determines if the attribute name comparison is case sensitive. Default value is false.

Remarks

If the attribute does not exist within the query string, JSV_getAttribute returns an empty string. If error checking is required, use the JSV_isEmpty function to check the value returned by JSV_getAttribute.

Dependencies

JSV_isWhitespace

Example

The following lines of code

var qs = "?ABC=123&L=Page1&Music=R%26B";
var value = JSV_getAttribute(qs, "Music");
document.write( "The attribute <I>Music</I> has a value of " + value.bold() );

produce