2013-11-14 40 views
0

我的按钮OnClick事件使用Javascript使用多个选择框中的选定选项填充两个宽文本框。填充文本框的表单按钮在Internet Explorer中不起作用

在Firefox和Chrome中一切正常,但在Internet Explorer中单击按钮时没有任何反应。我将不胜感激任何帮助。

<!DOCTYPE html> 
<html> 

<script type="text/javascript"> 

function addbutton1() { 

var box1 = document.getElementById('dropdown1').options[document.getElementById('dropdown1').selectedIndex].text; 
var box2 = document.getElementById('dropdown2').options[document.getElementById('dropdown2').selectedIndex].text; 
var box3 = document.getElementById('dropdown3').options[document.getElementById('dropdown3').selectedIndex].text; 
var box4 = document.getElementById('dropdown4').options[document.getElementById('dropdown4').selectedIndex].text; 
var box5 = document.getElementById('dropdown5').options[document.getElementById('dropdown5').selectedIndex].text; 
var box6 = document.getElementById('dropdown6').options[document.getElementById('dropdown6').selectedIndex].text; 

textbox1.value = box1 + ', ' + box2 + ', ' + box3 + ', ' + box4; 
textbox2.value = box5 + ', ' + box6; 
} 
</script> 

<body> 
<form name="customform" id="wstForm_Custom" action="%wstx.formmailerurl%" method="post" labelID="formLabel_CustomForm"> 
<style> 
#wstForm_Custom {background-color:transparent;} .specialEmailField {display: none;visibility:hidden;height:0px;} .emailDisplay {display: none;visibility:hidden;height:0px;} 
</style> 

<table> 

    <tr><td style="font-family:Arial; text-align: left; font-size: 10pt;">Row 1:</td> 

    <td><select style="width: 150px" id="dropdown1"> 
    <option value='0'>Select</option> 
    <option value='100.00'>Option 1a</option> 
    <option value='100.00'>Option 1b</option> 
    </select></td> 

    <td><select style="width: 150px" id="dropdown2"> 
    <option>Select</option> 
    <option>Option 2a</option> 
    <option>Option 2b</option> 
    </select></td></tr> 

    <tr><td style="font-family:Arial; text-align: left; font-size: 10pt;">Row 2:</td> 

    <td><select style="width: 150px" id="dropdown3"> 
    <option>Select</option> 
    <option>option 3a</option> 
    <option>Option 3b</option> 
    </select></td> 

    <td><select style="width: 150px" id="dropdown4"> 
    <option>Select</option> 
    <option>Option 4a</option> 
    <option>Option 4b</option> 
    </select></td> 

    <tr><td style="font-family:Arial; text-align: left; font-size: 10pt;">Row 3:</td> 

    <td><select style="width: 150px" id="dropdown5"> 
    <option value='0'>Select</option> 
    <option value='0'>Option 5a</option> 
    <option value='0'>Option 5b</option> 
    </select></td></tr> 

    <tr><td style="font-family:Arial; text-align: left; font-size: 10pt;">Row 4:</td> 

    <td><select style="width: 150px" id="dropdown6"> 
    <option value='0'>Select</option> 
    <option value='100.00'>Option 6a</option> 
    <option value='100.00'>Option 6b</option> 
    </select></td> 

</table> 

<button type="button" onclick="addbutton1(this.form)">Add Options to Textboxes</button> 

<table style="width: 700px"> 
<tr> 
<input style="width:480px" name="First Textbox" id="textbox1" type="text" AUTOCOMPLETE="OFF"/></td> 
</tr> 
<tr> 
<input style="width:480px" name="Second Textbox" id="textbox2" type="text" AUTOCOMPLETE="OFF"/></td> 
</tr> 
</table> 

<p style="width: 740px; text-align: center"> 

<input style="width:100px;" title="Submit" id="wstForm_Custom_Submit" onclick="return wstxSubmitForm(this);" type="submit" value="Submit"/> 

<input style="width:50px;" title="Reset Form" id="wstForm_Custom_Reset" type="reset" value="Reset"/> 

</p> 
</form> 
</body> 

回答

相关问题