display things by the name they enter

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • trpplayer

    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="JAVAS CRIPT" 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


  • Michael Winter

    #2
    Re: display things by the name they enter

    On Tue, 13 Jan 2004 11:55:07 GMT, trpplayer <dirk.brien@pan dora.be> wrote:
    [color=blue]
    > 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[/color]

    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').toLowerC ase()) {
    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.h tml';
    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="loadPa ge()">Load user page</BUTTON>

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

    Mike

    --
    Michael Winter
    M.Winter@blueyo nder.co.invalid (replace ".invalid" with ".uk" to reply)

    Comment

    • kaeli

      #3
      Re: display things by the name they enter

      In article <v0RMb.1326$LX4 .60147741@hesti a.telenet-ops.be>,
      dirk.brien@pand ora.be enlightened us with...[color=blue]
      > 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
      >[/color]

      Not sure why...
      [color=blue]
      > example:
      >
      > <SCRIPT LANGUAGE="JAVAS CRIPT" TYPE="TEXT/JAVASCRIPT">[/color]

      Lower case, I believe, is standard.
      [color=blue]
      >
      > var name;
      >
      > name = prompt('Give your name please:');
      > if (name != "myname")
      > {
      > 1.html;[/color]
      Change to
      top.location="1 .html";
      [color=blue]
      > }
      > else
      > {
      > 2.html;[/color]
      Change to
      top.location="2 .html";


      --
      --
      ~kaeli~
      No one is listening until you make a mistake.



      Comment

      • trpplayer

        #4
        Re: display things by the name they enter

        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" <tiny_one@NOSPA M.comcast.net> schreef in bericht
        news:MPG.1a6db9 a918e21af0989ac 1@nntp.lucent.c om...[color=blue]
        > In article <v0RMb.1326$LX4 .60147741@hesti a.telenet-ops.be>,
        > dirk.brien@pand ora.be enlightened us with...[color=green]
        > > Dear,
        > >
        > > I want to create an page where they have to enter ther name in an[/color][/color]
        prompt.[color=blue][color=green]
        > > by the name they entered i want to open different html page's
        > >[/color]
        >
        > Not sure why...
        >[color=green]
        > > example:
        > >
        > > <SCRIPT LANGUAGE="JAVAS CRIPT" TYPE="TEXT/JAVASCRIPT">[/color]
        >
        > Lower case, I believe, is standard.
        >[color=green]
        > >
        > > var name;
        > >
        > > name = prompt('Give your name please:');
        > > if (name != "myname")
        > > {
        > > 1.html;[/color]
        > Change to
        > top.location="1 .html";
        >[color=green]
        > > }
        > > else
        > > {
        > > 2.html;[/color]
        > 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
        >
        >[/color]


        Comment

        • Robin Goodall

          #5
          Re: display things by the name they enter

          trpplayer wrote:[color=blue]
          > "kaeli" <tiny_one@NOSPA M.comcast.net> schreef in bericht
          > news:MPG.1a6db9 a918e21af0989ac 1@nntp.lucent.c om...
          >[color=green]
          >>In article <v0RMb.1326$LX4 .60147741@hesti a.telenet-ops.be>,
          >>dirk.brien@pa ndora.be enlightened us with...
          >>[color=darkred]
          >>>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
          >>>[/color]
          >>Not sure why...
          >>[color=darkred]
          >>>example:
          >>>
          >>> <SCRIPT LANGUAGE="JAVAS CRIPT" TYPE="TEXT/JAVASCRIPT">[/color]
          >>
          >>Lower case, I believe, is standard.
          >>[color=darkred]
          >>> var name;
          >>>
          >>> name = prompt('Give your name please:');
          >>> if (name != "myname")
          >>> {
          >>> 1.html;[/color]
          >>
          >>Change to
          >>top.location= "1.html";
          >>
          >>[color=darkred]
          >>> }
          >>> else
          >>> {
          >>> 2.html;[/color]
          >>
          >>Change to
          >>top.location= "2.html";
          >>[/color]
          >
          > 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
          >[/color]

          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

          Comment

          • kaeli

            #6
            Re: display things by the name they enter

            In article <bu12v2$r21$1@p egasus.csx.cam. ac.uk>, anon@somewhere. com
            enlightened us with...[color=blue]
            >
            > 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.
            >[/color]

            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?



            Comment

            Working...