Forum Moderators: open
I am having a site for my family.
members of my family are : Steve,Melinda,Jessie and Roy.
I wanna do a javascipt to popup a window asking for name.
If the name entered is not any of the 4 names above, it will display 'You aren't part of da family.' on the webpage.
Yeah Iknow its lame and stupid but guess what it is actually my dad's idea!
Can anyone of you please help me?
Roy
<head>
...
<script language="JavaScript">
<!--
var userName = prompt("Give me your name: ","");
-->
</script>
...
</head>
<body>
...
<script language="JavaScript">
<!--
if ((userName!= 'Steve') && (userName!= 'Melinda') && (userName!= 'Jessie') && (userName!= 'Roy'))
{
document.write('You aren't part of da family.');
}
else
{
document.write('Welcome, ' + userName + '!');
}
-->
</script>
...
</body>
<body>
<script>
<!--
// moonbather
var yourname= prompt('Please enter your name:', ' ');
lcyourname=yourname.toLowerCase();
if ((lcyourname=='melinda') ¦¦ (lcyourname=='jessie'))
/* add the other names likewise */
document.write("<h1>Hello, " + yourname + ", and welcome! <\/h1>");
else document.write("<h1>Hey, Watcha doin\'! <br \/>You ain\'t parta da family! <\/h1>");
// -->
</script>