faqts : Computers : Programming : Languages : JavaScript : XML : E4X (ECMAScript for XML) : XMLList objects

+ Search
Add Entry AlertManage Folder Edit Entry Add page to http://del.icio.us/
Did You Find This Entry Useful?

0 of 1 people (0%) answered Yes
Recently 0 of 1 people (0%) answered Yes

Entry

How do I use the method contains?
How do I use the method contains?

Apr 15th, 2005 02:52
Martin Honnen,


The method contains takes one argument, the value to check for, and then
returns true if there is (at least) one XML object in the list that
compares equal to the value, otherwise false is returned.
Here are some examples:
  var xmlList = <>
    <god>Kibo</god>
    <god>Xibo</god>
  </>;
  alert(xmlList.contains(<god>Kibo</god>)); // shows 'true'
  alert(xmlList.contains(<god>Maho</god>)); // shows 'false'
  alert(xmlList.contains('Kibo')); 
  // shows 'true' as <god>Kibo</god> == 'Kibo' yields true