We will create a input area(postcode), and the button open the url plus the text typed by user:

Let’s create a input area:

<form><label for="postcode">PostCode:</label>

<input id="postcode" maxlength="4" name="postcode" type="number" />


Note down the id in the <input> tag, which will be used in the javascript.

Next we will create a button with onclick event:

<button onclick="find_store()">Show Me</button>

Then let’s add a script in the footer of the html :


<script type="text/JavaScript">
function find_store() {
//Find the value in the input area
var postcode = document.getElementById('postcode').value;

var store_page = "https://frankfu.click/store_contact/#";

var store_contact = store_page + postcode;

window.open(store_contact, '_blank').focus();

And you may have guessed that in the store_contact, I created multiple div with different ID, which represent the postcode.