JavaScript Development
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
 
User Name:
Password:
Remember me
 
Go Back   Dev Articles Community ForumsProgrammingJavaScript Development

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Display Modes
 
Unread Dev Articles Community Forums Sponsor:
  #1  
Old November 27th, 2003, 09:21 PM
kwlayman kwlayman is offline
Junior Member
Dev Articles Newbie (0 - 499 posts)
 
Join Date: Nov 2003
Posts: 2 kwlayman User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
dynamic select problem on IE

I'm having a problem populating a select list in an iframe by calling a function on the parent. I'm making the call from body onload of the iframe.

This works fine on Mozilla, and the code works fine if the select is placed on the parent form and called from there.

Looking at the code in the debugger the select object appears to be fine, but IE complains 'Object doesn't support this property or method' when the select is on the iframe. Here's how I'm inserting the new element;

function AddToOptionList(OptionList, OptionValue, OptionText) {
// Add option to the bottom of the list
OptionList.options[OptionList.length] = new Option(OptionText, OptionValue);

Reply With Quote
  #2  
Old November 28th, 2003, 01:37 AM
stumpy's Avatar
stumpy stumpy is offline
May contain nuts.
Dev Articles Regular (2000 - 2499 posts)
 
Join Date: Aug 2002
Location: Sydney, AU
Posts: 2,058 stumpy User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 5 h 8 m 57 sec
Reputation Power: 9
Send a message via ICQ to stumpy Send a message via MSN to stumpy
What value are you assigning "OptionList", the first function parameter?
__________________
DevArticles Moderator
BlueSix - Web Development and Consulting

Reply With Quote
  #3  
Old November 28th, 2003, 05:13 PM
kwlayman kwlayman is offline
Junior Member
Dev Articles Newbie (0 - 499 posts)
 
Join Date: Nov 2003
Posts: 2 kwlayman User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
I pass the result of document.getElementById('selectListID') back to the function on the parent.


The object appears to be correct when inspected in the debugger, and works when called from within the parent frame, but IE gags when I pass this from the iframe.

Reply With Quote
  #4  
Old November 28th, 2003, 06:24 PM
stumpy's Avatar
stumpy stumpy is offline
May contain nuts.
Dev Articles Regular (2000 - 2499 posts)
 
Join Date: Aug 2002
Location: Sydney, AU
Posts: 2,058 stumpy User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 5 h 8 m 57 sec
Reputation Power: 9
Send a message via ICQ to stumpy Send a message via MSN to stumpy
document. refers to the current document. Therefore, I wouldn't think you would be able to refer to an object in an Iframe using only document.getElement(), because an iframe is usually treated as a unique frame (document). Instead refer to the iframe using the correct DOM.
Code:
parent.frames.yourIframeName.document.getElementBy  Id("foo")


Note also that IE5 iframes must have a name tag (ID alone won't work). NS6/Moz must have an ID tag. So, use both, with the same value.

Reply With Quote
Reply

Viewing: Dev Articles Community ForumsProgrammingJavaScript Development > dynamic select problem on IE


Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump


Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 





© 2003-2008 by Developer Shed. All rights reserved. DS Cluster 1 hosted by Hostway
Stay green...Green IT