var n = ''; if(document.formname.inputname.value == 'string') { n = x; }
<a href="javascript: window.location = 'url&number=' + n;">test</a>