/    Sign up×
Community /Pin to ProfileBookmark

Need help with a javascript script

i am trying to make a script for a website of mine, the goal i’m trying to acheive is to make a greeting message.
first of all i want a prompt box to come up saying what is your clan name, and if they enter elfwoods then a alert box to come up saying your a member welcome.
but if they enter something differnt or nothing i want a alert box to say your a enemy leave.

this is a script i made my self but it dosnt work in the way i wanted can anyone help?

<script type=”text/javascript”>
<!–
var userName = prompt(“Please enter your clan name.”, “”);
if ( (userName >= “elfwoods”) || (userName == null) ) {
alert(“Welcome you are a member”);
}
else {
alert(“your an enemy leave”);
}

//–>
</script>

i apologise for my lack of knowlage in javascript but i only started lerning yesterday.

thanks alot javan00b

to post a comment
JavaScript

4 Comments(s)

Copy linkTweet thisAlerts:
@javan00bauthorSep 08.2005 — im sorry if anyone was working on a script but i woked it out my self.

my lack of experience and very little knowlage of javascript left me writting it in the wrong way this is the way it should be done.

<script type="text/javascript">

<!--

var clanName = prompt('what clan do you belong too?','');

if (clanName=="elfwoods") {

alert("welcome member");

}

else {

alert("your an enemy leave");

}


//-->

</script>
Copy linkTweet thisAlerts:
@JPnycSep 08.2005 — Glad the script works, but it's "You're an enemy" "your" is possesive case. To be correct it should read "You're an enemy. Leave."
Copy linkTweet thisAlerts:
@jamSep 08.2005 — jut looking over the script i just thought that if you want to you can force them to leave by changing the script to:

<script type="text/javascript">

<!--

var clanName = prompt('what clan do you belong too?','');

if (clanName=="elfwoods") {

alert("welcome member");

}

else {

alert("your an enemy leave");

[B]window.close();[/B]

}


//-->

</script>
Copy linkTweet thisAlerts:
@javan00bauthorSep 08.2005 — guys thanks alot espesh for last post deff gna use that script thanks for the help much apreciated

thanks alot javan00b
×

Success!

Help @javan00b spread the word by sharing this article on Twitter...

Tweet This
Sign in
Forgot password?
Sign in with TwitchSign in with GithubCreate Account
about: ({
version: 0.1.9 BETA 5.18,
whats_new: community page,
up_next: more Davinci•003 tasks,
coming_soon: events calendar,
social: @webDeveloperHQ
});

legal: ({
terms: of use,
privacy: policy
});
changelog: (
version: 0.1.9,
notes: added community page

version: 0.1.8,
notes: added Davinci•003

version: 0.1.7,
notes: upvote answers to bounties

version: 0.1.6,
notes: article editor refresh
)...
recent_tips: (
tipper: @AriseFacilitySolutions09,
tipped: article
amount: 1000 SATS,

tipper: @Yussuf4331,
tipped: article
amount: 1000 SATS,

tipper: @darkwebsites540,
tipped: article
amount: 10 SATS,
)...