-1

Points: I dont mind if users can see it using - view source. I don't really know much about this but I really want to get this working.

I need to add a password to this somehow, I need it so that if a person enters "hello" it will redirect, if anything else is entered nothing happens.

<div class="wrapper">

    <form class="form1" action="http://google.com">

        <div class="formtitle">Enter the password to proceed</div>

        <div class="input nobottomborder">
            <div class="inputtext">Password: </div>
            <div class="inputcontent">

                <input type="password" />
                <br/>

            </div>
        </div>

        <div class="buttons">

            <input class="orangebutton" type="submit" value="Login" />


        </div>

</div>  
4

3 回答 3

4

假设使用重定向意味着允许表单提交,

为您的密码字段命名

<input type="password" name="pass" />

和改变

<form class="form1" action="http://google.com">

<form class="form1" action="http://google.com" onsubmit="return (this.pass.value==='hello')?true:false;">

演示在http://jsfiddle.net/nCfQ4/1/

于 2012-10-08T14:54:48.280 回答
3

看看onsumbit:

<form class="form1" action="http://google.com" onsubmit="return document.getElementById('password').value=='hello';">
....
    <input type="password" id="password"/>
.....
于 2012-10-08T14:55:37.153 回答
1

好吧,您有很多选择,但我认为最好的是 PHP,您可以使用 JS,但人们将能够阅读代码。

PHP 与该方法的 POST 然后访问数据库等。

于 2012-10-08T14:23:00.093 回答