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)