Hi there theremotedr,
It is bad practise to name files with a space like this
HONDA 006.html
I would suggest that you rename them like this
HONDA-006.html
Then use this new
index.html...
Code:
<!DOCTYPE HTML>
<html lang="en">
<head>
<base href="https://www.theremotedoctor.co.uk/">
<meta charset="utf-8">
<meta name="viewport" content="width=device-width,height=device-height,initial-scale=1">
<title>Part Peeper</title>
<link rel="shortcut icon" href="favicon-logo/favicon.ico" type="image/x-icon" >
<link rel="stylesheet" href="css/latestChanges.css" media="screen">
<style media="screen">
body {
background-image: url( m-images/background.png );
text-align:center;
}
h1, p {
color: #009;
}
form {
display: inline-block;
padding: 2em 1em 1em;
border: 1px solid #009;
background-color: #fff;
font-size: 1.25em;
}
input {
width:90%;
margin: 1em 0;
font-size: 1em;
text-align: center;
}
</style>
</head>
<body>
<h1>PART IDENTIFIER</h1>
<form action="#">
<label for="part">ENTER PIN</label><br>
<input type="text" id="part" ><br>
<input type="button" value="CLICK TO SHOW">
</form>
<script>
(function( d ) {
'use strict';
d.querySelector('form').reset();
d.querySelector('input[type="button"]').addEventListener( 'click',
function() {
var pattern = /[^0-9](?=[0-9])/g,
part = d.querySelector( '#part' );
part.value = part.value.replace( pattern, '$& ').toUpperCase();
setTimeout(
function(){
location.href = '/m-images/emailref/' + part.value .replace(/\s/,'-') + '.html';
},1000 );
} , false );
}( document ));
</script>
</body>
</html>
This has the added advantage of allowing you type
in a wide variety of text like these...
- HONDA 006
- honda 006
- honda006
- HoNdA 006
- hOnDa006
..and they would all take you to
HONDA-006.html
coothead
Bookmarks