wlad2, тогда может так?
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8" />
<title></title>
</head>
<body>
<form class="my-form" action="">
<input class="url" type="text" />
<input class="param-one" type="text" value="tp1__" size="5" />
<input class="param-two" type="text" value="comm_" size="5" />
<input type="submit" value="Результат" />
</form>
<br />
<textarea class="result" name="" id="" cols="80" rows="10"></textarea>
<script>
var myForm = document.querySelector('.my-form'),
url = myForm.querySelector('.url'),
paramOne = myForm.querySelector('.param-one'),
paramTwo = myForm.querySelector('.param-two'),
result = document.querySelector('.result');
myForm.onsubmit = function() {
var links = {
firstLink: url.value.replace(/(&sub=)([^"']+)/, '$1' + paramOne.value + '$2'),
secondLink: url.value.replace(/(&sub=)([^"']+)/, '$1' + paramOne.value + paramTwo.value + '$2')
};
for(var link in links) {
result.insertAdjacentHTML('beforeEnd', '<a class="" href="" data-link="' + links[link] + '">' + link + '</a><br />');
}
return false;
};
</script>
</body>
</html>