BullyWiiHacks
Welcome dear guest! Very Happy

To start posting and being part of the BWH community, you simply need to register an account or log into an existing one.

If you do not wish to register at all, that's fine but there will be more advertisements. :/

You can probably see and download most content provided for regular members even without an account.

Your contributions will be greatly appreciated though, give it a shot and register today! thumbsup

Join the forum, it's quick and easy

BullyWiiHacks
Welcome dear guest! Very Happy

To start posting and being part of the BWH community, you simply need to register an account or log into an existing one.

If you do not wish to register at all, that's fine but there will be more advertisements. :/

You can probably see and download most content provided for regular members even without an account.

Your contributions will be greatly appreciated though, give it a shot and register today! thumbsup
BullyWiiHacks
Would you like to react to this message? Create an account in a few clicks or log in to continue.
BullyWiiHacks

Gaming, Modding & Programming

Important reminders:

- Click *HERE* for advanced forum search or check out the text field below on the front page for Google before posting
- NO support via private message (use the forum)
- Write meaningful topic titles
Site Translation
Latest topics
» Dropped Out of College to Pursue Web Dev and Life Pursuits in General
[Help]Login Script (JavaScript) Empty4/7/2024, 2:34 pm by SnB@BWH

» Bully Made It Into a BIG Video 400K Views
[Help]Login Script (JavaScript) Empty4/7/2024, 6:58 am by Bully@WiiPlaza

» Wii Play Tanks
[Help]Login Script (JavaScript) Empty3/24/2024, 2:46 pm by helpmeout

» [Bypass Paywalls] (Global) @magnolia1234 - GitLab
[Help]Login Script (JavaScript) Empty3/18/2024, 3:55 am by Seth@WiiPlaza

» [Download] Mary Shelley's Frankenhole
[Help]Login Script (JavaScript) Empty3/16/2024, 8:29 am by Seth@WiiPlaza

» Completely Custom Modded Controllers (Undetectable)
[Help]Login Script (JavaScript) Empty3/5/2024, 1:55 pm by Shadow@BWH

» (Zombies) Drink perks code?
[Help]Login Script (JavaScript) Empty3/5/2024, 1:24 pm by Shadow@BWH

» Die Rückkehr zu STEAM und WARFACE
[Help]Login Script (JavaScript) Empty3/2/2024, 3:54 am by Seth@WiiPlaza

» First person hand model change?
[Help]Login Script (JavaScript) Empty2/28/2024, 4:53 am by Ad3lamac611

» {RELEASE} Field Raider Firefox v1.72 by Seth@WiiPlaza
[Help]Login Script (JavaScript) Empty2/21/2024, 8:52 am by naxil

Search
 
 

Display results as :
 


Rechercher Advanced Search

April 2024
MonTueWedThuFriSatSun
1234567
891011121314
15161718192021
22232425262728
2930     

Calendar Calendar

Country Statistics
Free counters!

You are not connected. Please login or register

[Help]Login Script (JavaScript)

3 posters

Go down  Message [Page 1 of 1]

1[Help]Login Script (JavaScript) Empty [Help]Login Script (JavaScript) 3/12/2015, 6:30 am

Shadow@BWH

Shadow@BWH
 
 

I can't seem to figure out what's wrong with the code. The first prompt is working right but the second one only reads it as the error message.

Code:
var register = prompt("You are not registered, please type a password to register:");

function succsess() {
    document.write("Succsess! You are now in the registered users page");
}

function failed() {
    document.write("Wrong Password! Try again");
}

if (register = "") {
    alert("ERROR: You have to type something as a password");
} else {
    var user = prompt("You have registered with a valid password");
}
if (register == user) {
    succsess();
} else {
    failed();
}



Last edited by Shadow@BWH on 3/12/2015, 7:48 am; edited 1 time in total


_________________
[Help]Login Script (JavaScript) Ezgif-com-video-to-gif-converter

[Help]Login Script (JavaScript) GIFMaker-me

[Help]Login Script (JavaScript) BAjMdNS

SnB@BWH

SnB@BWH
Admin & Writer

Isn't it that in every language, the code is read from top to bottom? I don't know JS very well, in fact I'm learning it myself, but shouldn't this be reversed?

Your code:
Code:
if (register = "") {
    var user = prompt("You have registered with a valid password");
} else {
    alert("ERROR: You have to type something as a password");
Reversed code:
Code:
if (register = "") {
    alert("ERROR: You have to type something as a password");
} else {
    var user = prompt("You have registered with a valid password");


_________________
[Help]Login Script (JavaScript) Simple10

[Help]Login Script (JavaScript) LSTjSyDDiscord: SnB_BWH

Click HERE to earn free bitcoin, litecoin, dogecoin, and dash!

Win Free Bitcoins every hour!

Shadow@BWH

Shadow@BWH
 
 

Ya your right. Only issue is it won't take the error anymore. It's weird.


_________________
[Help]Login Script (JavaScript) Ezgif-com-video-to-gif-converter

[Help]Login Script (JavaScript) GIFMaker-me

[Help]Login Script (JavaScript) BAjMdNS

Bully@WiiPlaza

Bully@WiiPlaza
 
 

You have to declare the variable "user" outside of the else block.
Code:
var register = prompt("You are not registered, please type a password to register:");
var user = "";

function succsess() {
    document.write("Succsess! You are now in the registered users page");
}

function failed() {
    document.write("Wrong Password! Try again");
}

if (register = "") {
    alert("ERROR: You have to type something as a password");
} else {
    user = prompt("You have registered with a valid password");
}
if (register == user) {
    succsess();
} else {
    failed();
}
The semantics of the code are beyond me though.


_________________
[Help]Login Script (JavaScript) YBjg74I

Sponsored content



Back to top  Message [Page 1 of 1]

Permissions in this forum:
You cannot reply to topics in this forum