473,398 Members | 2,212 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,398 software developers and data experts.

problem with : document.createElement("iframe") and onload

1.
Expand|Select|Wrap|Line Numbers
  1. newFrame = document.createElement("iframe");       
  2. newFrame.id='aa1';
  3. newFrame.onload = aa(this.id);
  4. document.getElementsByTagName('body')[0].appendChild(newFrame);
  5. function aa(id){alert(id);}
  6.  
output: undefined
2.
Expand|Select|Wrap|Line Numbers
  1. document.write("<br><iframe id = 'aa1' onload = 'aa(this.id)'></iframe>");
  2. function aa(id){alert(id);}
  3. output: aa1
  4.  
Why in 1 output undefined?
Aug 22 '11 #1
3 3161
johny10151981
1,059 1GB
What is this object? where does it come from? this object is invalid here. resolve it first
Aug 23 '11 #2
onload is Body ELement function....
I think what u need is
Expand|Select|Wrap|Line Numbers
  1. newFrame = document.createElement("iframe");       
  2. newFrame.id = 'aa1';
  3. document.body.appendChild(newFrame) ;
  4. document.body.onload = aa(newFrame.id) ;
  5. function aa(id){alert(id);}
  6.  
Aug 24 '11 #3
resolved, thank you!
Aug 24 '11 #4

Sign in to post your reply or Sign up for a free account.

Similar topics

2
by: Andrew Poulos | last post by:
I'm having some trouble getting document.createElement to work with IE 5. Is this because it's unsupported? And, if it is unsupported, is using innerHTML a valid workaround? Andrew Poulos
3
by: Silmar | last post by:
Hi! In my form I have table which cells contain input objects of type="text" which initially are disabled. I would like to activate them by clicking on them. However because input object does...
6
by: Jon Davis | last post by:
I recently learned how to do an <OBJECT> alternative to <IFRAME> in current browsers using: <object id="extendedhtml" type="text/html" data="otherpage.html" width="250" height="400"></object> ...
3
by: davidkarlsson74 | last post by:
Error: document.getElementById("folderMenu").cells has no properties File: http://www.volkswagen.se/tillbehor/js/foldermenu.js Rad: 49 The function activates different DIV:s, but doesn't seem to...
7
by: christian | last post by:
hi there! i've the following piece of html: <div id="tbl"></div> and i'm trying to create an object with the following javascript code: var objDiv = document.getElementById("tbl"); var...
10
by: webEater | last post by:
Hello, I try the following in Firefox and other modern browsers: window.addEventListener('load', function() { document.title = CSS.getClass('fontSize'); var div = document.createElement('div');...
6
by: linuxnooby | last post by:
Hi I want a form field to be selected when the page loads. But I get the error message Error: document.getElementById("ff") has no properties any ideas what I am doing wrong? code below
1
by: dharshanav | last post by:
Hi All, Is there a way to make the Mozilla browser behave the same way as IE when using in the design mode? For IE: <div id="left_div" contenteditable="true" frameborder="no"...
4
by: tswaters | last post by:
Alright, so generally I'm using document.createElement("IMG").... but, I've noticed something just recently that made me switch to "new Image()" What I'm doing is creating a photo gallery of...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
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
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...

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.