473,322 Members | 1,911 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,322 software developers and data experts.

Based on login ID display content

Hi

I have one requirement that, Based on the User ID the content should display on the page. How can we do that, I don't have much knowledge on javascript but I tried its not working. Please help me and please refer some gud websites to learn javascript.

Below is the code that I have tried,

Expand|Select|Wrap|Line Numbers
  1.  <script type="text/javascript">
  2.      function pinnu()
  3.      {
  4.      if(document.login.pinnumber.value == '001')
  5.      {
  6.      window.location="paid_Card.html";
  7.      document.getelemntByID("prepaid").card.innerHTML = "test test test";
  8.       }
  9.  
  10.      }
  11.      </script>
Sep 5 '08 #1
7 1603
Ferris
101 100+
I am sorry i am not able to get your requirement clearly. What is "User Id" and "content"? Where is it? and what is "paid_Card.html"? Please make it clear.

I can help to fix some syntax error in your code:

line 6 should be:
Expand|Select|Wrap|Line Numbers
  1. window.location.href="paid_Card.html";
line 7 should be:
Expand|Select|Wrap|Line Numbers
  1. document.getElementById("prepaid").card.innerHTML = "test test test";
Sep 5 '08 #2
I am sorry i am not able to get your requirement clearly. What is "User Id" and "content"? Where is it? and what is "paid_Card.html"? Please make it clear.

I can help to fix some syntax error in your code:

line 6 should be:
Expand|Select|Wrap|Line Numbers
  1. window.location.href="paid_Card.html";
line 7 should be:
Expand|Select|Wrap|Line Numbers
  1. document.getElementById("prepaid").card.innerHTML = "test test test";
Hi, Thanks for reply.

The requirement is like this, this is for HTMl page only, There is no backend coding.

1. There are 3 login IDs are there Ex: 001, 002, 003
2. The User will come to the login page and he enter his Id number (ex:001),
3. Onclick on submit button the page will go to paid_Card.html page
4. There is diffrent text or content for diffrent IDs,
Ex: for 001 ( Hi welcome to the test page and read the content)
For 002 ( How are u? what are u doing some text)

5. Based on the user ID (001), the text has to display in paid_Card.html page.

6. If user enters 002 in login page, It will go to same page (paid_Card.html) But the text or content is diffrent.


I think now u will get clear idea. Please let me, if u need more information....
Sep 5 '08 #3
RamananKalirajan
608 512MB
Hi, i hope this will help u out. Just have a look over this code. any doubt post back to the forum

This is your Login Page

[HTML]<html>
<form method="get" action="paid_Card.html">
User Name: <input type="text" name="Uname">
<br/>
<input type="submit" value="Login">
</form>
</html>[/HTML]

paid_Card.html
[HTML]<html>
<head>
<script type="text/javascript">
function checkLogin()
{
var val = location.search;
var x = new Array();
x = val.split("=");
var log=x[1];
if(log=="c001")
document.getElementById('myDiv1').style.display='b lock';
else if(log=="c002")
document.getElementById('myDiv2').style.display='b lock';
else if(log=="c003")
document.getElementById('myDiv3').style.display='b lock';
else
document.getElementById('myDiv4').innerHTML="<font color='red'>You are a invalid User</font>"
}
function doHide()
{
document.getElementById('myDiv1').style.display='n one';
document.getElementById('myDiv2').style.display='n one';
document.getElementById('myDiv3').style.display='n one';
checkLogin();
}
</script>
</head>
<body onload="doHide()">
<div id="mydiv1">
<table>
<tr>
<td>
This is for User c001
</td>
</tr>
</table>
</div>
<div id="mydiv2">
<table>
<tr>
<td>
This is for User c002
</td>
</tr>
</table>

</div>
<div id="mydiv3">
<table>
<tr>
<td>
This is for User c003
</td>
</tr>
</table>
</div>
<div id="myDiv4">
</div>
</body>
</html>[/HTML]

Regards
Ramanan Kalirajan
Sep 5 '08 #4
Hi, i hope this will help u out. Just have a look over this code. any doubt post back to the forum

This is your Login Page

[HTML]<html>
<form method="get" action="paid_Card.html">
User Name: <input type="text" name="Uname">
<br/>
<input type="submit" value="Login">
</form>
</html>[/HTML]

paid_Card.html
[HTML]<html>
<head>
<script type="text/javascript">
function checkLogin()
{
var val = location.search;
var x = new Array();
x = val.split("=");
var log=x[1];
if(log=="c001")
document.getElementById('myDiv1').style.display='b lock';
else if(log=="c002")
document.getElementById('myDiv2').style.display='b lock';
else if(log=="c003")
document.getElementById('myDiv3').style.display='b lock';
else
document.getElementById('myDiv4').innerHTML="<font color='red'>You are a invalid User</font>"
}
function doHide()
{
document.getElementById('myDiv1').style.display='n one';
document.getElementById('myDiv2').style.display='n one';
document.getElementById('myDiv3').style.display='n one';
checkLogin();
}
</script>
</head>
<body onload="doHide()">
<div id="mydiv1">
<table>
<tr>
<td>
This is for User c001
</td>
</tr>
</table>
</div>
<div id="mydiv2">
<table>
<tr>
<td>
This is for User c002
</td>
</tr>
</table>

</div>
<div id="mydiv3">
<table>
<tr>
<td>
This is for User c003
</td>
</tr>
</table>
</div>
<div id="myDiv4">
</div>
</body>
</html>[/HTML]

Regards
Ramanan Kalirajan
Hi,

Its working fine..... Thank you so much for your help. Please refer me some URLs to learn javascript.
Sep 5 '08 #5
gits
5,390 Expert Mod 4TB
you may have a look at the offsite links thread of our js-forum ...

kind regards
Sep 5 '08 #6
acoder
16,027 Expert Mod 8TB
The requirement is like this, this is for HTMl page only, There is no backend coding.
Since you mention that this is a login ID, you should have this code on the server-side. Anyone could view the source and get the valid IDs.
Sep 5 '08 #7
RamananKalirajan
608 512MB
Hi,

Its working fine..... Thank you so much for your help. Please refer me some URLs to learn javascript.
Hi I am happy that you got ur requirement. The url's in the first thread named "offsite link" will be useful for u. In future any probs or doubts post it in the forum i will try to help u out. As you asked w3schools will be best for any beginners.

Regards
Ramanan Kalirajan
Sep 5 '08 #8

Sign in to post your reply or Sign up for a free account.

Similar topics

11
by: Bozo Schmozo | last post by:
Greetings! I've searched groups.google.com already to see if I can determine if using PHP/MySQL (if needed) for a web site I wish to develop. As the subject indicated, it will be a content...
1
by: Rob | last post by:
I have an ASP.NET application that uses forms-based authentication. A user wishes to be able to run multiple sessions of this application simultaneously from the user's client machine. The...
3
by: | last post by:
One thing I did a lot of in Classic ASP involved showing page elements conditionally based on whether a user was logged in or not. Logged in users or "superusers" would get more content and/or more...
1
by: soni2926 | last post by:
hi, we're building a site which will have common pages for different users, but certain sections will show different content based on the membership of the logged in user, like admin, manager,...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.