/    Sign up×
Community /Pin to ProfileBookmark

document object Model

hmmm…i’ve found that using:
document.body.removeChild(reference to object);
this can only remove object that is static, which is not created by document.write(“<object name=”….

but when i use document.write(“<object name=… to create an object….then set interval time to remove this object..
it doesn’t work…

Do you know why?
any solution?
and one more,
can we use document.write to write to current document,
for example now i’m using body background=black, then after i run document.write(“<object… it seems it write to a new page, the background turn to normal white again…
i wanna keep the document as what it is initially after document.write…..can i do that?

Thx

to post a comment
JavaScript

5 Comments(s)

Copy linkTweet thisAlerts:
@FangJan 09.2004 — Use [COLOR=green]document.createElement("object")[/COLOR] to insert an element rather then using document.write

document.write does exactly that (re)writes the document.
Copy linkTweet thisAlerts:
@vcorn4authorJan 09.2004 — yes, i've tried using document.createElement("object"), but it doesn't work, i use it for flash movie, the movie is not loaded

it works when i used embed, document.createElement("embed"); this one works pretty well.

but now i want to use object, can anyone help me?

see whether this one is correct or not..

var panam = document.createElement("<OBJECT name='flashMovie' classid='clsid?27CDB6E-AE6D-11cf-96B8-444553540000' codebase='http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,40,0' STYLE='POSITION: absolute; HEIGHT:27%;WIDTH:25%;TOP:330;LEFT:325;VISIBILITY:VISIBLE;'><param name='movie' value='intro1.swf'><param name='play' value='true'></OBJECT>");

my second try is:

var anam = document.createElement("param");

anam.setAttribute("movie",'intro1.swf');

var panam = document.createElement("object");

panam.setAttribute("classid",'clsid?27CDB6E-AE6D-11cf-96B8-444553540000');

panam.setAttribute("codebase",'http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,40,0');

panam.setAttribute("height","25%");

panam.setAttribute("width","25%");

document.body.appendChild("panam");

document.body.panam.appendChild("anam");

this one also didn't work,

can anyone help?
Copy linkTweet thisAlerts:
@Khalid_AliJan 09.2004 — [i]Originally posted by vcorn4 [/i]

[B]

var panam = document.createElement("<OBJECT name='flashMovie' classid='clsid?27CDB6E-AE6D-11cf-96B8-444553540000' .............

can anyone help? [/B]
[/QUOTE]


The above is wrong.

create element takes only elements name and then you can use setAttribute to set its attribute list.

I think you might be able to do the abovve using

get reference to the parent element where that object element be and then use this

parentEl.innerHTML = "<OBJECT name='flashMovie' classid='clsid27CDB6E-AE6D-11cf-96B8-444553540000' codebase='http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,40,0' STYLE='POSITION: absolute; HEIGHT:27%;WIDTH:25%;TOP:330;LEFT:325;VISIBILITY:V

ISIBLE;'><param name='movie' value='intro1.swf'><param name='play' value='true'></OBJECT>";

this shouls work if you can don't know how to use createElement.
Copy linkTweet thisAlerts:
@vcorn4authorJan 09.2004 — thx, but i didn't understand..

Do you know the way to create object

using document.createElement("object");

and the respective param tag,

i want to embed the flash movie as an object, anyone know the code?

Thx
Copy linkTweet thisAlerts:
@Khalid_AliJan 09.2004 — some times IE does not refre****self when you add an element.in that case.

say you created an element say

newEl

not do this newEl.parentNode.innerHTML=newEl.parentNode

.it might help,however,its just a hack not a real solution
×

Success!

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