/    Sign up×
Community /Pin to ProfileBookmark

Javascript include

hi to everybody,
I have a problem on an input field of a form which I have associated an Onchange event to.
The Onchange event recalls the following Javascript function:

<Script language=”javascript”>
function Cambia()

{

document.write(‘<‘ + ‘script language=”javascript” type=”text/javascript” src=”listalocalita5.js” ></script>’);

}
</Script>

The code does not execute and the window of the Browser closes.
If instead I explode the code of the Script inside the function executes it correctly.
Can someone tell me because?

I thank in advance whoever will want to answer me.

Fullavia

to post a comment
JavaScript

1 Comments(s)

Copy linkTweet thisAlerts:
@felgallJul 24.2006 — Running document.write after the page finishes loading overwrites the entire page with the content making a new page. Your new page consists of nothing but a script tag and so it will display nothing and do nothing.
×

Success!

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