/    Sign up×
Community /Pin to ProfileBookmark

Name Alert with regular alert problem

The problem I am having is that when ever I use a regular alert and I make the name alert come next, it doesn’t. It skips over it and goes to the next alert. And at the end it says the name. How can I fix it?

[CODE]<script language=”Javascript”>

<!–
alert (“Alert”)
//–>

</script>
<script language=”Javascript”>

<!–
alert (“Alert”)
//–>

</script>
<body>
<BODY
onLoad=”testIt()”>
</body>
<head>
<SCRIPT LANGUAGE=”JavaScript”>

<!– Begin
function testIt() {
Response = “”;
while ((Response == “”) || (Response == “”)){
Response=prompt (“What’s your name?”, “”);
}
if (Response != null)
alert (“Hello, ” + Response + “!”);
}
// End –>
</SCRIPT>
</head>
<script language=”Javascript”>

<!–
alert (“Alert”)
//–>

</script>
<script language=”Javascript”>

<!–
alert (“Alert”)
//–>

</script>[/CODE]

to post a comment
JavaScript

7 Comments(s)

Copy linkTweet thisAlerts:
@phpnoviceMay 07.2006 — Why does your HEAD section follow your BODY section?
Copy linkTweet thisAlerts:
@CharlesMay 07.2006 — And there are so many other problems there that it is hard to know where to start to get you back on the right path.

Try working with just one SCRIPT element and no other HTML.
Copy linkTweet thisAlerts:
@Metroid9824authorMay 07.2006 — Because, your head is attached to your body, and if your head wasn't attached to your body, you would be dead. But what does that have to do with my problem?
Copy linkTweet thisAlerts:
@CharlesMay 07.2006 — But what does that have to do with my problem?[/QUOTE]A great deal actually. Take a look at what you posted above, you'll note HEAD and BODY's scattered about.
Copy linkTweet thisAlerts:
@Metroid9824authorMay 07.2006 — Yeah, should I get rid of it, or something.
Copy linkTweet thisAlerts:
@phpnoviceMay 07.2006 — Because, your head is attached to your body...[/QUOTE]
Except mine is firmly planted atop my body -- not coming out the posterior. :rolleyes:
Copy linkTweet thisAlerts:
@felgallMay 07.2006 — Partial cleanup of your code.

&lt;script type="text/javascript"&gt;
alert ("Alert")
alert ("Alert")
&lt;/script&gt;&lt;/head&gt;
&lt;body&gt;
&lt;script type="text/javascript"&gt;
function testIt() {
Response = "";
while ((Response == "") || (Response == "")){
Response=prompt ("What's your name?", "");
}
if (Response != null)
alert ("Hello, " + Response + "!");
}

alert ("Alert")
alert ("Alert")
&lt;/script&gt;
×

Success!

Help @Metroid9824 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,
)...