Location.search
The search property can be set with new values that alter the current URL.
assume starting at http://www.java2s.com/BOOK/index.htm
location.search = "?q=javascript";
changes URL to "http://www.java2s.com/BOOK/index.htm?q=javascript"
<!DOCTYPE HTML>
<html>
<head>
<title>Example</title>
</head>
<body>
<script>
location.search = "?q=javascript";
</script>
</body>
</html>