The x_tip function can be used to write a text tip to an element using innerHTML.
<span title="tip" alt="tip" style="x_tip_style">text</span>; which works like this: .
I&';ve included all the country and state names &n-; just pass the 2 character code as the text and x_country or x_state as the tip and the tip will be the country or state name.
<script>x_tip('US','x_country','','element')</script> yields .
The tip can be the 3 character Country code if you like: x_tip=x_country_iso3 .
It&';s better to just pass your own value for the tip for population, area, density, currency, and language as those may change and I&';m not going to keep that close track of things unless I need them. You&';re welcome to copy the code and change the values you need and keep them up-to-date. You can also use it as a template to design your own text tip arrays. Currency and language are less likely to change, but the official language of South Sudan has changed twice since 2005. Some countries such as Bolivia have several official languages &n-; I chose to only list those spoken by the most people.
Now, back to the 3 character country code. That&';s not very useful as a tip. It would be more useful if you could pass the 2 character code, display the 3 character code, have the tip be the country name. Well, you can. But first, let me use population as an example of how you&';d do this.
<script>x_tip('US','x_pop','','element')</script> yields .
<script>x_tip('US','x_pop','US population','','element')</script> yields .
Now for the 3 character code.
<script>x_tip('US','x_country','x_country_iso3','element')</script> yields .
<script>x_tip('US','x_country_iso2','x_country')</script> yields .
You can only pass an x_... value for the display text when the tip is x_country_iso2, x_country_iso3, x_country, x_curr, x_lang, x_st_iso2, x_state. The x_... which you can pass for the display text are x_country_iso3, x_country, x_curr, x_lang, x_flag, x_flag_img, x_state, and x_st_flag_img.
The display text can be flags x_flag, x_flag_img, x_flag_emoji, x_st_flag_img. To use the emoji/unicode flag as your tip, pass x_flag as the display text. As late as , Windows displays the two character country code rather than the actual flag. So, if the user&';s platform is Windows, x_tip displays the flag image instead. . If you want to always display the flag emoji/unicode regardless of platform, use x_flag_emoji rather than x_flag. . x_flag_emoji will not display the flag when using Windows.
To display an audio control pass something like
<audio controls><source src="horse.mp3" type="audio/mpeg"></audio> for the display text.
Similar to countries and states, you can set up your own nested array and x_tip will use it; but only one nested array &n-; x_tips_array.