I have done it another way (see coding below), but can you not use: onclick="openURL();" rather than onclick="makeURL();" - this doesn't seem to work if I change it?
Also does anyone know how to get this form to submit when enter is pressed, it just reloads the page and if i type in type="submit" the whole form stops working. I've made this from an example in a tutorial so it may not be 100% right, although it does work - although when i click on back, the previous page doesn't always load - says page not found - only happens when I added this code??!
Any help would be greatly appreciated.
<script>
function makeURL() {
var baseURL = 'http://www.example.com/info.php?id=';
var pfxmnumber = 'mnumber=';
var mnumber = document.form1.mnumber.value;
var url = baseURL + mnumber
pfxmnumber + mnumber;
location = url;
}
</script>
<form name="form1" id="form1" method="post" action="">
<p align="center">
<font size="2" face="Arial, Helvetica, sans-serif"><b>Or</b><br> Search by ID:
<input name="mnumber" type="number" size="5" id="mnumber" value=""/><br>
<input name="Search ID" type="button" id="Search ID" value="Search ID" onclick="makeURL();" />
</font></p>
</form>