2013-11-14 2 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> 

답변

0

당신은 document.getElementById('textbox1').value 간단하지 textbox1.value를 사용해야합니다.

다음은 예입니다. http://jsfiddle.net/WbTmf/1/

관련 문제