flyte,
<!DOCTYPE html>
<html>
<head>
<title>Untitled</title>
<meta charset="utf-8">
<script>
window.addEventListener('DOMContentLoaded', function() {
var url = 'http://qwerty.com/index.cgi?id=12345;name=winter' // var url = window.location;
var d = url.match(/id=([^;]+)/);
var w = url.match(/name=([^;]+)/);
d = d ? d[1] : "";
w = w ? w[1] : "";
document.querySelector('[name="one"]').value = d;
document.querySelector('[name="two"]').value = w;
});
</script>
</head>
<body>
<input name="one" type="text">
<input name="two" type="text">
</body>
</html>
|