PDA

View Full Version : WML Help!!



Herb_IV
26-05-2003, 02:24 PM
Can anyone tell me WHY this code dont Work???

<?xml version="1.0"?>
<!DOCTYPE wml PUBLIC "-//WAPFORUM//DTD WML 1.1//EN" "http://www.wapforum.org/DTD/wml_1.1.xml">
<wml>
<card title="Welcome">
<script language="JavaScript">
BuildPanel();
</script>
</card>
<script language="JavaScript">
var successpage = "index.wml"; // The page users go to after login, if they have no personal page.
var loginpage = "login.wml"; //Change this to the page the login panel is on.

var imgSubmit = ""; //Change to the path to your login image,if you don't want the standard button, otherwise do not change.
var imgReset = ""; //Change to the path to your reset image,if you don't want the standard button, otherwise do not change.

var users = new Array();

users[0] = new Array("username1","password1",""); // Change these two entries to valid logins.
users[1] = new Array("username2","password2",""); // Add addtional logins, straight after these, as
// required, followig the same format. Increment the
// numbers in the square brackets, in new each one. Note:
// the 3rd parameter is the the page that user goes to
// after successful login. Ensure the paths are correct.
// Make this "" if user has no personal page.
//----------------------------------------------------------------
// Login Functions
//----------------------------------------------------------------
function login(username,password){
var member = null;
var loggedin = 0;
var members = users.length;
for(x=0;x<members && !loggedin; x++){
if((username==users[x][0])&&(password==users[x][1])){
loggedin = 1;
member = x;
break; // User validated, terminate the for loop.
}
}

if(loggedin==1){
if(users[member][2] != "") {
successpage = users[member][2];
}
top.location.href = successpage;
}
else {
alert('access denied');
}
}

function logout() {
top.location.href = loginpage;
}



//----------------------------------------------------------------
// Login Panel
//----------------------------------------------------------------

function BuildPanel() {
document.write('<form name="logon"><table align="left" border="0"><tr><td align="right">');
document.write('<small><font face="Verdana">Username:</font></small></td>');
document.write('<td><small><font face="Verdana"><input type="text" name="username" size="20"></font></small></td></tr>');
document.write('<tr><td align="right"><small><font face="Verdana">Password:</font></small></td>');
document.write('<td><small><font face="Verdana"><input type="password" name="password" size="20"></font></small></td></tr>');
if(imgSubmit == ""){
document.write('<tr><td align="center" colspan="2"><p><input type="button" value="Logon" name="Logon" onclick="login(username.value,password.value)">');
} else {
document.write('<tr><td align="center" colspan="2"><p><input type="image" src="'+imgSubmit+'" name="Logon" onclick="login(username.value,password.value)">');
}
if(imgReset == ""){
document.write('<input type="reset" value="Reset" name="Reset">');
} else {
document.write('<input type="image" src="'+imgReset+'" name="Reset" onclick="logon.reset();">');
}
document.write('</p></td></tr></table></form>');
}


</script>
</wml>

Herb_IV
01-06-2003, 04:31 AM
bump