Skip to content

Instantly share code, notes, and snippets.

@electronicbites
Created September 23, 2010 13:58
Show Gist options
  • Save electronicbites/593643 to your computer and use it in GitHub Desktop.
Save electronicbites/593643 to your computer and use it in GitHub Desktop.
change href dynamic
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="de" lang="de">
<head>
<meta http-equiv="content-type" content="text/html; charset=utf-8" />
<title>test_change_link</title>
<script type="text/javascript" language="javascript">
// <![CDATA[
function changeLink() {
var linkelem = document.getElementById('mylink');
//alert(linkelem.href);
linkelem.href += "&wilma=washere";
alert(linkelem.href);
}
// ]]>
</script>
</head>
<body onload="javascript:changeLink();">
<a href="http://www.google.com/search?client=safari&rls=en&q=javascript&ie=UTF-8&oe=UTF-8" id="mylink" target="_new">
</a>
</body>
</html>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment