Click here to Skip to main content
15,887,485 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
form id=form_id method=post name=myform
Login Form

div
input type=text placeholder=UserName id=username
div

div
input type=password placeholder=Password id=password
div

button type="button" class=btn btn-success> Login button

script type="text/javascript"
function validate()
{
var username = document.getElementById("username").value;
var password = document.getElementById("password").value;
if ( username == "user" && password == "pass")
{
window.location="TravelRequest.html";
}
}


i am showing the menu based on username and password, if username is user and password is pass,

Then in browser shows the menu name as TravelRequest.html

in browser i have menu as follow


Employee
Profile (when user clicks the profile it will go to profile.html)
Registration (when user clicks the Registration it will go to Registration.html)

TravelRequest (when user clicks the TravelRequest it will go to TravelRequest.html)

when user types the user and pass in username and password i want to display the profile and Registration menus

for that how to do. i am writing a code in html page.

What I have tried:

form id=form_id method=post name=myform
Login Form

div
input type=text placeholder=UserName id=username
div

div
input type=password placeholder=Password id=password
div

button type="button" class=btn btn-success> Login button

script type="text/javascript"
function validate()
{
var username = document.getElementById("username").value;
var password = document.getElementById("password").value;
if ( username == "user" && password == "pass")
{
window.location="TravelRequest.html";
}
}


i am showing the menu based on username and password, if username is user and password is pass,

Then in browser shows the menu name as TravelRequest.html

in browser i have menu as follow


Employee
Profile (when user clicks the profile it will go to profile.html)
Registration (when user clicks the Registration it will go to Registration.html)

TravelRequest (when user clicks the TravelRequest it will go to TravelRequest.html)

when user types the user and pass in username and password i want to display the profile and Registration menus

for that how to do. i am writing a code in html page.
Posted
Updated 1-Jan-18 19:12pm

1 solution

by default hide the elements by using display:none[^]
once when the condition is matched the show the element by display:block[^]
JavaScript
if(condition-is-true){
document.getElementById('Id-for-the-element').style.display = 'block'
}


Five Ways to Hide Elements in CSS [^]
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900