/    Sign up×
Community /Pin to ProfileBookmark

Strange about Netscape 7.02

Take a look att this simple code:

[CODE]<html>
<head>
<title>Untitled Document</title>
<script language=”JavaScript”>
<!–
function testare() {
document.write(document.forms[0].elements[0].value);
}
//–>
</script>
</head>
<body>
<form>
<input type=”text” value=”saedhdh” />
</form>
<p><a href=”javascript:testare()”>test</a></p>
</body>
</html>[/CODE]

This works good in IE6 (SP1), but “fails” in NN7.02.

The problem seems to be the line “document.write…”.

In IE the loading stops as soon as this line is executed, but in NN7 it just goes on and on… (doing nothing).

Is this a known error in NN or is there something wrong in my code. ?

The real code is longer and includes writing to popups, and so on… but to show the problem I wrote this simple code.

Greetings
/Marcus

to post a comment
JavaScript

5 Comments(s)

Copy linkTweet thisAlerts:
@khalidali63Apr 14.2003 — Proper way if using statement is

document.open();

document.write(document.forms[0].elements[0].value);

document.close();

this will solve your problem

Cheers

Khalid
Copy linkTweet thisAlerts:
@mf22csauthorApr 15.2003 — Don't work...

document.open(); makes the document.forms[0]... to be invalid.

/Marcus
Copy linkTweet thisAlerts:
@AdamGundryApr 15.2003 — How about this?

function testare() {

var frmval = document.forms[0].elements[0].value;

document.open();

document.write(frmval);

document.close();

}

Adam
Copy linkTweet thisAlerts:
@mf22csauthorApr 15.2003 — That seems to work (have not tried yet, but will do). ?

Thanks!

/Marcus
Copy linkTweet thisAlerts:
@khalidali63Apr 15.2003 — [i]Originally posted by mf22cs [/i]

[B]Don't work...



document.open(); makes the document.forms[0]... to be invalid.



/Marcus [/B]
[/QUOTE]


This meas there is something else wrong in your code which is not posted here.The snippet I posted above will work provided there is at least 1 form in the page and this form have 1 element that has a value attribue.

?

Cheers

Khalid
×

Success!

Help @mf22cs 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.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: @AriseFacilitySolutions09,
tipped: article
amount: 1000 SATS,

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

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