473,499 Members | 1,609 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

display things by the name they enter

Dear,

I want to create an page where they have to enter ther name in an prompt.
by the name they entered i want to open different html page's

example:

<SCRIPT LANGUAGE="JAVASCRIPT" TYPE="TEXT/JAVASCRIPT">

var name;

name = prompt('Give your name please:');
if (name != "myname")
{
1.html;
}
else
{
2.html;
}
</SCRIPT>
my question is: how can i load these file's automaticly?

greetz Dirk
Jul 20 '05 #1
5 1292
On Tue, 13 Jan 2004 11:55:07 GMT, trpplayer <di********@pandora.be> wrote:
I want to create an page where they have to enter ther name in an prompt.
by the name they entered i want to open different html page's


Try:

<!--
The language attribute is not
required and it's use is discouraged
-->
<SCRIPT type="text/javascript">
function loadPage() {
switch( window.prompt('Please enter your name').toLowerCase()) {
case 'fred':
window.location = 'fred/index.html';
break;
case 'jill':
window.location = 'jill/index.html';
break;
case 'bob':
window.location = 'bob/index.html';
break;
case 'amy':
window.location = 'amy/index.html';
break;
default: // Loaded when no match for the entered name is
// found
window.location = 'no_such_name.html';
break;
}
}
</SCRIPT>

I assume that the names will be case-insensitive (hence the call to
toLowerCase()).

You could then call this function on a button press. For example,

<BUTTON type="button" onclick="loadPage()">Load user page</BUTTON>

You could also use an INPUT element instead of a prompt window.

Mike

--
Michael Winter
M.******@blueyonder.co.invalid (replace ".invalid" with ".uk" to reply)
Jul 20 '05 #2
In article <v0*********************@hestia.telenet-ops.be>,
di********@pandora.be enlightened us with...
Dear,

I want to create an page where they have to enter ther name in an prompt.
by the name they entered i want to open different html page's

Not sure why...
example:

<SCRIPT LANGUAGE="JAVASCRIPT" TYPE="TEXT/JAVASCRIPT">
Lower case, I believe, is standard.

var name;

name = prompt('Give your name please:');
if (name != "myname")
{
1.html; Change to
top.location="1.html";
}
else
{
2.html;

Change to
top.location="2.html";
--
--
~kaeli~
No one is listening until you make a mistake.
http://www.ipwebdesign.net/wildAtHeart
http://www.ipwebdesign.net/kaelisSpace

Jul 20 '05 #3
Thank you, this work's fine

By using this, only the persone for who is has been created can read it and
the rest get an blank page whith "NO ACCESS" or something like that
"kaeli" <ti******@NOSPAM.comcast.net> schreef in bericht
news:MP************************@nntp.lucent.com...
In article <v0*********************@hestia.telenet-ops.be>,
di********@pandora.be enlightened us with...
Dear,

I want to create an page where they have to enter ther name in an prompt. by the name they entered i want to open different html page's


Not sure why...
example:

<SCRIPT LANGUAGE="JAVASCRIPT" TYPE="TEXT/JAVASCRIPT">


Lower case, I believe, is standard.

var name;

name = prompt('Give your name please:');
if (name != "myname")
{
1.html;

Change to
top.location="1.html";
}
else
{
2.html;

Change to
top.location="2.html";
--
--
~kaeli~
No one is listening until you make a mistake.
http://www.ipwebdesign.net/wildAtHeart
http://www.ipwebdesign.net/kaelisSpace

Jul 20 '05 #4
trpplayer wrote:
"kaeli" <ti******@NOSPAM.comcast.net> schreef in bericht
news:MP************************@nntp.lucent.com...
In article <v0*********************@hestia.telenet-ops.be>,
di********@pandora.be enlightened us with...
Dear,

I want to create an page where they have to enter ther name in an prompt.
by the name they entered i want to open different html page's

Not sure why...
example:

<SCRIPT LANGUAGE="JAVASCRIPT" TYPE="TEXT/JAVASCRIPT">


Lower case, I believe, is standard.
var name;

name = prompt('Give your name please:');
if (name != "myname")
{
1.html;


Change to
top.location="1.html";

}
else
{
2.html;


Change to
top.location="2.html";


Thank you, this work's fine

By using this, only the persone for who is has been created can read it and
the rest get an blank page whith "NO ACCESS" or something like that


So I just disable javascript goto this page and look at the source (or
get the source via one of a multitude of ways that don't evaluate the
javascript). I see "myname". I enable javascript, reload the page, use
the 'secret' "myname" and get to 1.html. Or having seen the source I
just go directly to 1.html

You cannot secure your site with client-side scripting, it needs to be
done server-side. Well, I cannot see a way you could anyway but I bet
someone here will say otherwise.

Robin

Jul 20 '05 #5
In article <bu**********@pegasus.csx.cam.ac.uk>, an**@somewhere.com
enlightened us with...

You cannot secure your site with client-side scripting, it needs to be
done server-side. Well, I cannot see a way you could anyway but I bet
someone here will say otherwise.


Nope, can't be done.
Any idiot can view a source.
Anyone with enough free time can figure out a way around client-side
"protection", no matter how obfuscated it is. This has been discussed to
death here.

Best you can do is Flash. That's pretty hard to crack. A person needs to
get the Flash, decompile it, etc.
But it CAN be done.

--
--
~kaeli~
Is it true that cannibals don't eat clowns because they
taste funny?
http://www.ipwebdesign.net/wildAtHeart
http://www.ipwebdesign.net/kaelisSpace

Jul 20 '05 #6

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

4
10021
by: James | last post by:
Hello, I have a RequiredFieldValidator for several textbox controls on a form. Here's an example with the RequiredFieldValidator. EnableClientScript, Enabled, and Visible are set to true for...
4
1811
by: singh79 | last post by:
Hi Pls Any One Solve My Problem. One Text box for Enter user Name.My Requirement is if web application is Run then, In Textbox Display "Pls Enter User name" If Click By Mouse the text Is...
14
4335
by: confusedfusion | last post by:
Not sure how many form submissions that have been lost over the years before I started but the company has a contact form that the required fields when validation fails the error message is going...
1
1905
by: spynx | last post by:
import javax.swing.JOptionPane; import java.io.*; import java.util.Arrays; public class election5 { public static void main( String args ) {
0
7180
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
7229
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
1
6905
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
7395
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
5485
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
4609
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...
0
3103
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
667
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
0
311
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence...

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.