/    Sign up×
Community /Pin to ProfileBookmark

Can I add a SWF to a .js file using document.write?

I’m curious…

Is it possible to add a whole <object> tag and all the elements inside to an external javascript file using document.write?

I have this flash poll that I want to use on my website… but I want it to appear on all the pages and I will be changing that poll weekly… so I thought I’d throw that in a javascript file using document.write…

Could that work or does anyone have any other ideas?

Thanks!

WD

to post a comment
JavaScript

3 Comments(s)

Copy linkTweet thisAlerts:
@mityaSep 15.2009 — Well what happens when you try it?

Avoid innerHTML and DOM-script it (e.g. var obj = document.createElement('object'); document.appendChild(obj); obj.src = ........ etc).
Copy linkTweet thisAlerts:
@criterion9Sep 16.2009 — You could easily use swfobject since it is javascript based anyways. http://code.google.com/p/swfobject/
Copy linkTweet thisAlerts:
@wdes2009authorSep 17.2009 — Hi Criterion,

Thanks for the info! I've never heard of that before and I'm looking forward to trying it out later today!

WD
×

Success!

Help @wdes2009 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 6.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: @nearjob,
tipped: article
amount: 1000 SATS,

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

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