/    Sign up×
Community /Pin to ProfileBookmark

Javascript noob needs help

been staring at this for hours and cant figure it out. It will probably take a veteran about 5 seconds to see the problem.

i need to use onBlur and alert to show what user entered in the field.

Here is the script. I greatly appreciate any help

<HTML>
<HEAD>
<TITLE> Excercise 4 </TITLE>

</HEAD>
<script language=javascript1.2>

function party_bar() {
status=(“Republican, Democrat, Independant or Undeclared “);}

function party_message() {
var answer;
answer = getparty.value
alert(answer);
return answer;}

</script>
<BODY onLoad= “status=’This is an online political survey'”>

<FORM >
What is your Name?
<input name=”name” size=30 maxlength=40><BR>

What is your political party?
<input type=”text” value=answer name=party size=”30″ onFocus=”party_bar()” onBlur=”party_message()”><BR>

</FORM>

</BODY>
</HTML>

to post a comment
JavaScript

1 Comments(s)

Copy linkTweet thisAlerts:
@AdamGundryApr 13.2003 — What exactly is the problem? It could be that you are referring to "getparty.value" incorrectly, try this instead:

answer = document.getElementById('party').value;

Adam
×

Success!

Help @Treebeard 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 6.17,
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: @nearjob,
tipped: article
amount: 1000 SATS,

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

tipper: @meenaratha,
tipped: article
amount: 1000 SATS,
)...