See also: addAttribute getAttribute, deleteAttribute

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

Syntax

JSV_setAttribute(expQ, attribute, value [, caseSensitive])

Prototype

expQ.setAttribute(attribute, value [, caseSensitive])

Returns

The query string with the attribute set to the passed value.

Parameters

The setAttribute 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 which to set the value.
value The value to set the attribute in the query string.
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 in the query string, then JSV_setAttribute will add the attribute/value pair to the query string.

Dependencies

JSV_isWhitespace

Example

The following lines of code

var qs = "?ABC=123&L=Page1&Music=R%26B";
var newQS = JSV_setAttribute(qs, "ABC", "Backus-Naur Form");
document.write( 
    "The query string " + 
    qs.bold() + 
    " is now " + 
    newQS.bold() );

produce