Jump to content

HTML forms help


leftreal
 Share

Recommended Posts

Hi, I am still a rookie when it comes to HTML and would like to create a form that has a single input field.

 

I would like it to show a password field but whatever you type in it would add the html file extension to it and take you to that page.

 

Example,

 

Say you type monkey then click submit.

 

It would take you to monkey.html which is a webpage within my website.

 

Please help... I keep trying stuff and I am getting more confused the more I try it.

 

Thank you

Jesse

Edited by leftreal
Link to comment
Share on other sites

Seems very impractical. Why not use an available HTML/CSS feature such as drop-down menus, styled links or an image map?

 

Here is your idea...

<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8"/>
<title>title</title>
</head>

<body>

<h4>Type in "monkey" to jump to secret monkey.html</h4>

Password:<br/>
<input type="password" id="filename">
<input type="button" id="btn1" value="Go">

<script>
'use strict';
document.getElementById('btn1').onclick = function(){
  window.location.assign(document.getElementById('filename').value.trim() + '.html');
}
</script>
</body>    
</html>
Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

×
×
  • Create New...