The Web Design Group

... Making the Web accessible to all.

Welcome Guest ( Log In | Register )

> Google Sites, HELP!
jainilsutaria
post Dec 4 2014, 06:37 PM
Post #1





Group: Members
Posts: 2
Joined: 4-December 14
Member No.: 21,890






So I wrote the code below for the site https://sites.google.com/pilabshare
and I want code such that when the user signs in with passwords: ["best", 'stupid', 'hprox', 'short', 'lnmi'], and with usernames ["jmoney", "ksut", "ish16", "neggyg", "lphp"] (respectively), it redirects the user to youtube.com (as a test site)
Why isnt this working?

CODE

<!DOCTYPE html>
<html>
<body>

Username: <input type="text" id="user" value="USERNAME">
Password: <input type="text" id="pass" value="PASSWORD">
<p>Please enter your username and password</p>

<button onclick="OPENPAGE()">Sign In</button>

<p id="demo"></p>

<script>
var passlist =
    ["best", 'stupid', 'hprox', 'short', 'lnmi']
var userlist = ["jmoney", "ksut", "ish16", "neggyg", "lphp"]
function OPENPAGE() {
   var usern = document.getElementById("user").value;
   var passn = document.getElementById("pass").value;
   var testnum = 0
   for (var item in passlist) {
      if ((passlist[item] == passn) && (usern == userlist[item])) {
         window.open("http://www.youtube.com","_self")
        
      }
   }
}
</script>

</body>
</html>
User is offlinePM
Go to the top of the page
Toggle Multi-post QuotingQuote Post

Posts in this topic


Reply to this topicStart new topic
1 User(s) are reading this topic (1 Guests and 0 Anonymous Users)
0 Members:

 



- Lo-Fi Version Time is now: 25th September 2024 - 08:21 PM