By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
459,442 Members | 1,265 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 459,442 IT Pros & Developers. It's quick & easy.

var= new Script(); ???

P: n/a
me
Hey all,

is it possible to make a vari =new Script(); object?

like when you do new Image(); or new Iframe()?

Cheers.

me
__________________________________________________ ________________ k zobra
ICQ#: 97557460 Current ICQ status: + More ways to contact me
__________________________________________________ ________________
Jul 20 '05 #1
Share this Question
Share on Google+
2 Replies


P: n/a


me wrote:
is it possible to make a vari =new Script(); object?

like when you do new Image(); or new Iframe()?


Which browser supports
new Iframe()
??
The W3C DOM allows you to create any element with
document.createElement('tagname')
so
if (document.createElement) {
var script = document.createElement('script');
}
creates the <script> element. However getting it to load a script
dynamically is very browser dependant, Netscape 7 should do, Opera 7.20
doesn't do it, and IE5+ should do:

var script;
if (document.createElement && ((script =
document.createElement('script')))) {
script.type = 'text/javascript';
script.src = 'test20031102.js';
var heads = document.getElementsByTagName('head');
if (heads[0]) {
heads[0].appendChild(script);
}
}
--

Martin Honnen
http://JavaScript.FAQTs.com/

Jul 20 '05 #2

P: n/a
me
Thanks :)

pd Iframe(0 was wrong hehe
function createIframe()
{
var myIframe = new Iframe;
return myIframe;
}

var frameObj=createIframe();

frameObj.document.body.innerHTML="<b>Hey There</b>";
//Writing something into the iframe
or your way with createElement

thnks

me

"Martin Honnen" <ma*******@yahoo.de> wrote in message
news:3f********@olaf.komtel.net...


me wrote:
is it possible to make a vari =new Script(); object?

like when you do new Image(); or new Iframe()?


Which browser supports
new Iframe()
??
The W3C DOM allows you to create any element with
document.createElement('tagname')
so
if (document.createElement) {
var script = document.createElement('script');
}
creates the <script> element. However getting it to load a script
dynamically is very browser dependant, Netscape 7 should do, Opera 7.20
doesn't do it, and IE5+ should do:

var script;
if (document.createElement && ((script =
document.createElement('script')))) {
script.type = 'text/javascript';
script.src = 'test20031102.js';
var heads = document.getElementsByTagName('head');
if (heads[0]) {
heads[0].appendChild(script);
}
}
--

Martin Honnen
http://JavaScript.FAQTs.com/

Jul 20 '05 #3

This discussion thread is closed

Replies have been disabled for this discussion.