0
can anybody help with how to create login page with displaying username on the top of the page
5 Answers
+ 1
do you want to dislpay username after user success login ? you can use session.. set and retrive your username session.
+ 1
I think this works , try to understand each step
<!Doctype html>
<html>
<body>
<p id="3"></p>
<input type="text" placeholder="Enter Username" name="username" id="1" /><br>. //id is important here
<input type="password" placeholder="Enter Password " name="Password" id="2" /><br>
<button type="button" onclick="login( ) " > Submit </button> /*onclick event is imp as ,on clicking the submit button it excecutes login function*/
<script>
Function login( )
{
a= document.getElementById("1").value; /*document.getElementById("1").value; is getting value we entered in username input */
b= document.getElementById("2").value;
document.getElementById("3").innerHTML="Welcome  " + a; /* innerHTML modifies or adds out output to html element (here element is paragraph */
}
</script>
</body>
</html>
Hope this one solves ur problem,happy coding
0
i have created a website there am using popup for login and by loging in i want username should be displayed. .i dnt know about session can u plz send me the coding anshar firman:)
0
no this coding doesnot show any result i tried
0
Atleast it's working for me & don't know about session ,lets see if anyone prints code