Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations derfloh on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

select.options[intstring].selected = true; in firefox?

Status
Not open for further replies.

Tracey

Programmer
Oct 16, 2000
690
NZ
Hi there

given the following xml file (and given that typeObj is an xml node "subscriptionttypeid"), could someone please tell me why
Code:
document.getElementById('subscriptiontype').options[typeObj.item(0).text].selected = true;

works in IE but

Code:
document.getElementById('subscriptiontype').options[typeObj.item(0).textContent].selected = true;

does not work in firefox? I get a getElementById("subscriptiontype") has no properties in firefox. I have tried wrapping the node value with CDATA tag but still get this error.

XML
Code:
<?xml version="1.0" encoding="utf-8" ?> 
- <subscriptions>
- <subscription>
- <sub>
- <![CDATA[ Silver
  ]]> 
  </sub>
- <datestarted>
- <![CDATA[ 25/10/2006
  ]]> 
  </datestarted>
- <dateexpires>
- <![CDATA[ 30/12/1899
  ]]> 
  </dateexpires>
- <custommonthlyrate>
- <![CDATA[ 2.50  ]]> 
  </custommonthlyrate>
  <subscriptiontypeid>4</subscriptiontypeid> 
- <subscriptionid>
- <![CDATA[ 2  ]]> 
  </subscriptionid>
- <iscurrent>
- <![CDATA[ 1  ]]> 
  </iscurrent>
  </subscription>
  </subscriptions>

Tracey
Remember... True happiness is not getting what you want...

Its wanting what you have got!
 
Yes you silly woman, you need to make sure you have the id set of the select element!! grr sorry for wasting forum space....



Tracey
Remember... True happiness is not getting what you want...

Its wanting what you have got!
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top