Get languages, localizarions and countries.

by Arturo Soto

HTML

<div>
    
    <div id="data"></div>
    
<table class="table table-countries" cellpadding="3" cellspacing="0" id="wp1250799table1250793"><caption><a name="wp1250799"> </a>
Table 20-1  &nbsp;ISO-3166 Country Codes
</caption>
    <thead>
            <tr bgcolor="#CCCCCC" align="center" valign="top">    <th scope="col"><div class="pCellHeading"><a name="wp1250803"> </a>
    Country 
    </div>
    </th>
        <th scope="col"><div class="pCellHeading"><a name="wp1250805"> </a>
    ISO-3166 Country Code
    </div>
    </th>
    </tr>  
    </thead>
  <tbody>
  <tr align="left" valign="top">    <td class="table" scope="row"><div class="pCellBody"><a name="wp1250807"> </a>
AFGHANISTAN
</div>
</td>
    <td class="table" scope="row"><div class="pCellBody"><a name="wp1250809"> </a>
AF 
</div>
</td>
</tr>
  <tr align="left" valign="top">    <td class="table" scope="row"><div class="pCellBody"><a name="wp1250811"> </a>
ALBANIA 
</div>
</td>
    <td class="table" scope="row"><div class="pCellBody"><a name="wp1250813"> </a>
AL
</div>
</td>
</tr>
  <tr align="left" valign="top">    <td class="table" scope="row"><div class="pCellBody"><a name="wp1250815"> </a>
ALGERIA
</div>
</td>
    <td class="table" scope="row"><div class="pCellBody"><a name="wp1250817"> </a>
DZ
</div>
</td>
</tr>
  <tr align="left" valign="top">    <td class="table" scope="row"><div class="pCellBody"><a name="wp1250819"> </a>
AMERICAN SAMOA 
</div>
</td>
    <td class="table" scope="row"><div class="pCellBody"><a name="wp1250821"> </a>
AS 
</div>
</td>
</tr>
  <tr align="left" valign="top">    <td class="table" scope="row"><div class="pCellBody"><a name="wp1250823"> </a>
ANDORRA 
</div>
</td>
    <td class="table" scope="row"><div class="pCellBody"><a name="wp1250825"> </a>
AD 
</div>
</td>
</tr>
  <tr align="left" valign="top">    <td class="table" scope="row"><div class="pCellBody"><a name="wp1250827"> </a>
ANGOLA
</div>
</td>
    <td class="table" scope="row"><div class="pCellBody"><a name="wp1250829">...

CSS

.table-countries {
    width: 80%;
    margin: 0% 10%;
    display: none;
}
.table-countries tr {
    display: none;
}

JavaScript

// Here You can type your custom JavaScript...
// From http://docs.oracle.com/cd/E13214_01/wli/docs92/xref/xqisocodes.html
//

$(document).ready(function (){
    var count = 0;
    var language = '';
    var location = '';
    var country = '';
    
    $('.table-countries tbody > tr').each(function() {
        count ++;
        $('td > div > a',this).remove();
        
        
        var auxCode = $('td:last-child > div',this).html().trim();
        var auxName = $('td:first-child > div',this).html().trim();
        country += '("'+auxCode+'", "'+auxName+'"),';
    });
    
    $(data).append('<p>'+count+'</p>');
    $(data).append('<p>'+country+'</p>');
    console.log(count);
    console.log(language);
    console.log(location);
});