/    Sign up×
Community /Pin to ProfileBookmark

How may a created document be displayed?

Hellow everyone!

I beleive that something is wrong with this script, but I do not know how to put it right.
What I am trying is an exapmle of creating a document and display it preferably in an iframe.

[code=php]
<!DOCTYPE HTML PUBLIC “-//W3C//DTD HTML 4.01 Transitional//EN”>
<HTML>
<HEAD>
<SCRIPT type=”text/javascript”>
<!–
function Crtdocument(){
SAHEEFAH= document.createDocumentFragment();
SAHEEFAH.innerHTML= “<BODY>An inner text</BODY>”;
window.ETARR.src= SAHEEFAH;
}
// –>
</SCRIPT>
</HEAD>
<BODY onload=”Crtdocument()”>
<IFRAME name=”ETARR” src=””></IFRAME>
</BODY>
</HTML>
[/code]

to post a comment
JavaScript

2 Comments(s)

Copy linkTweet thisAlerts:
@KorOct 21.2004 — You have not append the fragment.(appendChild, insertBefore or replaceChild... I don't know, it's your otion according to the needs)

If you wanna use DOM, this case you may be consequent and use createElement instead of innerHTML method...

What you wanna do, in fact?
Copy linkTweet thisAlerts:
@Lotfi_AbdolhalauthorOct 21.2004 — Thank you very much Dear KOR!

By trying again guided by your advice, I developed the script as follows, but still it is not displable. Can you see any further mistake in it that prevent its working?

[code=php]<SCRIPT type="text/javascript">
<!--
function Crtdocument(){
SAHEEFAH= document.createDocumentFragment();
MOKAW_N= document.createElement("BODY");
TXTNOD= document.createTextNode("An inner text");
MOKAW_N.appendChild(TXTNOD);
SAHEEFAH.appendChild(MOKAW_N);
window.ETARR.src= SAHEEFAH;
}
// -->
</SCRIPT>
[/code]
×

Success!

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