473,473 Members | 1,841 Online
Bytes | Software Development & Data Engineering Community
Create Post

Home Posts Topics Members FAQ

var= new Script(); ???

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
2 11378


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
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 thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

4
by: Karsten | last post by:
Hi I don't get this, could anyone help me out here, thanks :) When I load this page, I always gets the "wrong" alert and password is undefined, but how do I detect this in the code? Checking...
13
by: n2K | last post by:
I have a var in a javascript like so: <script language="javascript"> var timerID = null; var timerRunning = false; var timeIncrement = 0; LATER in the code I need to assign a session var to...
4
by: Bas van der Veer | last post by:
Hi, if I put the line: var T = new Array(-1); anywhere in my script, it stops working. e.g <SCRIPT LANGUAGE="JAVASCRIPT"> <!--
3
by: Brian | last post by:
Hi I'm trying to get a small script working I need to get the user to input some info from a prompt and then use that info in a PHP script, but I can't seem to assign the JavaScript var to a...
15
by: Frances | last post by:
<html> <head> <script> function doIt() { var list = document.forms.product; var selItem = list.options.value; ^^^^^^^ </head>
2
by: Frank | last post by:
Can I do this? I add a session var in C# and ultimatly want to pass it into a vbscript client side activeX control. This is what I have so far but get " Object Required:'name2' " error. Can...
35
by: Thierry Loiseau | last post by:
Hello all, and Happy end year 2005 ! Well, I would like to obtain a list of all JavaScript var statement, With "for...in" perharps ? That is bellow my recent test here, but the problem is...
3
by: sundew | last post by:
so here is the test case: <head> <script type='text/javascript'> // this function simply returns the number of enumerable namespaces(objects) function numNSpaces(){ var num = 0; for(var i in...
5
eragon
by: eragon | last post by:
I am making a password script, i have most of it done, ill show you, but i hit a brick wall.... lol, I have it so when you log in it takes you to your main page, that works, but when you enter the...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
0
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated ...
0
muto222
php
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
0
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.