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 IamaSherpa on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

PROBLEM USING function new Option with UFT-8 files in especial chars::

Status
Not open for further replies.

dioxyde

Programmer
Oct 29, 2005
4
ES
Check this... how can i show í??

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<html>
<head>
<meta http-equiv="content-type" content="text/html; charset=UTF-8">
<SCRIPT language=JavaScript>
function populate() {
var option = new Option("Almería","01");
var option2 = new Option("Almer&iacute;a","02");
eval("document.myform.myselect.options[0]=option");
eval("document.myform.myselect.options[1]=option2");
}
</SCRIPT>
</head>
<body onload='javascript:populate()'>
<form name=myform>
<select name="myselect"></select>
</form>
</body>
</html>
 
>[tt]var option2 = new Option("Almer&iacute;a","02");[/tt]
[tt]var option2 = new Option("Almer[red]\00ED[/red]a","02");[/tt]
Also you won't be left in peace with your use of eval(). It is not recommended if alternative is avail.

 
You do not need those evals() - as tsuji mentions. The following works just as well:
Code:
document.myform.myselect.options[0]=option;
document.myform.myselect.options[1]=option2";

Cheers,
Jeff

[tt]Jeff's Page [/tt][tt]@[/tt][tt] Code Couch
[/tt]

What is Javascript? faq216-6094
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top