populate multiple hidden fields onchange of a dropdown

populate multiple hidden fields onchange of a dropdown

I am populating a struts2 select dropdown with a list as shown below

<s:select name="code" id="code" headerKey="-1" headerValue="Select" list="slist" listValue="code" listKey="id" onchange="changeLocation(this.selectedIndex)" />

slist contains id,code,country . When a value (i.e code) is selected from dropdown ,i need to populate both id and country as hidden fields .I am successful in populating id onchange of code as shown below

onchange="document.getElementById('locationValue').value=this.options[this.selectedIndex].text;"

But when i try to figure out a way how to do this in a javascript function so that i can set both id and country as hidden fields when code changes. Please guide me how to acheive this

function changeSenderLoc(index)
{
    var strUser = dd.options[dd.selectedIndex].value;
    document.getElementById('locationValue').value=e.options[e.selectedIndex].text;
    document.getElementById('countryId').value=e.options[e.selectedIndex].********;
}