Example: Add a query parameter to the end of a link
This presumes that there is a link with the id "article".
var a = document.getElementById('article');
if (a.href.match(/\?/i)) {
// link already contains other parameters, so append "&printer=1"
a.href += '&printer=1';
} else {
// link does not contain any parameters, so append "?printer=1"
a.href += '?printer=1';
}