...

View Full Version : works in Mozilla but not in IE



amir
12-30-2005, 06:06 AM
<script>
function copyvalue(){
val=document.compose.receiver.value;
val1=document.combo_box.list.options[document.combo_box.list.selectedIndex].value;
if(val1!='' && val.indexOf(val1,0)== -1)
document.compose.receiver.value+=val1+ ',';
}
</script>

By this code, i m taking usernames of employees in a textbox to send message.

vwphillips
12-30-2005, 10:04 AM
document.combo_box.list.selectedIndex]
should be
document.reciever.combo_box.list.selectedIndex]

this will reduce you typos

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
"http://www.w3.org/TR/html4/loose.dtd">

<html>

<head>
<title></title>
<script>

function copyvalue(f){
val=f.receiver.value;
val1=f.combo_box.options[f.combo_box.selectedIndex].value;
if(val1!='' && val.indexOf(val1,0)== -1)
document.compose.receiver.value+=val1+ ',';
}

</script>
</head>

<body>
<form name="compose" >
<select name="combo_box" onchange="copyvalue(this.form);">
<option value="tom" >Tom</option>
<option value="dick" >dick</option>
<option value="harry" >harry</option>
</select>
<input name="receiver" size="50" >

</form>
</body>

</html>



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum