Results 1 to 1 of 1

Thread: [RESOLVED] Change select to input

  1. #1
    Join Date
    Jan 2012

    resolved [RESOLVED] Change select to input

    Ive changed my code below to reflect the working code

    Im trying to do the change via divs and it should work once i figure out the javascript function. this is the basis of my code(naturally ive stripped out the unimportant stuff)
    HTML Code:
    <script type="text/javascript">
    function state(a) {
    	if(a == 'CA'){
    		document.getElementById('inputOption').style.visibility = 'hidden';
    		document.getElementById('selectOption').style.visibility = 'visible';
    		document.getElementById('inputOption').style.visibility = 'visible';
    		document.getElementById('selectOption').style.visibility = 'hidden';
    <table width="916">
    <tr><td width="50%" valign="top" height="25" align="right"><span class="mainsmall"><?=$lar[40]?>:</span></td><td align="left" valign="top">
    <div id="inputOption" style="position:absolute; "><input type="text" name="State" class="comname" /></div>
    <div id="selectOption" style="position:absolute; visibility:hidden">
    <select name="country">
    <option value="1">stuff</option>
    <option value="2">Lots of stuff</option>
    <option value="3">more stuff</option>
    <tr><td width="50%" valign="middle" height="25" align="right"><span class="mainsmall"><?=$lar[41]?>:</span></td><td align="left">
    <select name="country" onchange="state(this.options[this.selectedIndex].value)">
    <option value="US">United States</option>
    <option value="CA">Canada</option>
    <option value="BB">Barbados</option>
    Last edited by Da_Elf; 11-06-2012 at 11:10 AM.

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
HTML5 Development Center