/    Sign up×
Community /Pin to ProfileBookmark

Explaination Please

Could some one tell me why the following code works in IE but not FF?

I get no errors in either browser to determine why.

Purpose: I want to seletively enter information into a textarea from an textbox. IE works as expected when the checkbox is selected for either or both areas. FF seems to reset and clear all fields and redisplays blank???

Note: I have only tried it in IE (works). Doesn’t work in FF and NS-7.

Thanks for any information.

[CODE]

<html>
<head>
<title>Function Parameters Test</title>
<script language=”javascript”>
<!–
function Enter(tform) {
if (tform.ListCB.checked) { tform.List.value += tform.EnterFld.value+’n’; }
if (tform.PgmCB.checked) { tform.Pgm.value += tform.EnterFld.value+’n’; }
tform.EnterFld.value = ”; tform.EnterFld.focus();
}
//–>
</script>
</head>

<body>
<h1>Function Parameter Test</h1>
<form name=”FuncForm”>

<input type=”text” name=”EnterFld” value=””>
<button name=”EnterBtn” onClick=”javascript:Enter(this.form)”>Enter</button>
<P>
<textarea name=”List” rows=5 cols=20 value=””></textarea>
<input type=”checkbox” name=”ListCB” value=”List”>List
<P>
<textarea name=”Pgm” rows=5 cols=20 value=””></textarea>
<input type=”checkbox” name=”PgmCB” value=”Pgm”>Pgm

</form>
</body>
</html>

[/CODE]

to post a comment
JavaScript

3 Comments(s)

Copy linkTweet thisAlerts:
@A1ien51Feb 24.2006 — do not add javascript in the onclick

onClick="[COLOR=DarkRed]javascript:[/COLOR]Enter(this.form)">

add return false to keep it from submitting

onclick="Enter(this.form);return false;">

Eric
Copy linkTweet thisAlerts:
@JMRKERauthorFeb 24.2006 — As they say in the Army - 'Tanks, Tanks alot' ?
Copy linkTweet thisAlerts:
@phpnoviceFeb 24.2006 — FF seems to reset and clear all fields and redisplays blank???[/QUOTE]
It wasn't explicitly stated above as the problem, so I'll clarify that what you're observing is FF submitting the form to itself. That is why the fields clear.
×

Success!

Help @JMRKER 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 4.29,
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: @Yussuf4331,
tipped: article
amount: 1000 SATS,

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

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