Advertisement
If you have a new account but are having problems posting or verifying your account, please email us on hello@boards.ie for help. Thanks :)
Hello all! Please ensure that you are posting a new thread or question in the appropriate forum. The Feedback forum is overwhelmed with questions that are having to be moved elsewhere. If you need help to verify your account contact hello@boards.ie
Hi there,
There is an issue with role permissions that is being worked on at the moment.
If you are having trouble with access or permissions on regional forums please post here to get access: https://www.boards.ie/discussion/2058365403/you-do-not-have-permission-for-that#latest

Javascript - The worst language know to mankind

  • 15-02-2005 10:10am
    #1
    Closed Accounts Posts: 25


    Would anyone be able to help on this:

    The following code works OK in IE6.0 but does not work in Netscape 7.1

    <head>
    </head>
    <body onload="" ><div align="center"><div style="height:*; width:780px;" class="BkWhite">
    DMPR - H<BR>
    <form name="abcdForm" method="post" action="">

    <script>
    function updateResult(formname,destOut,destReturn,destReturnHidden){

    //alert("document.forms[formname].name: "+document.forms[formname].name);
    eval("var outText = "+document.forms[formname].name +"."+destOut+".options["+document.forms[formname].name +"."+destOut+".selectedIndex].text;");
    eval("var outValue = "+document.forms[formname].name+"."+destOut+".options["+document.forms[formname].name+"."+destOut+".selectedIndex].value;");

    eval(document.forms[formname].name+"."+destReturn+".value = outText;");
    if(destReturnHidden.length > 0){
    eval(document.forms[formname].name+"."+destReturnHidden+".value = outValue;");
    }
    }
    </script>

    <table width="100%">
    <tr>
    <td valign="top">
    <select name="abcdSelect" size="4"
    onchange="javascript:updateResult('abcdForm','abcdSelect','txtResult','')" style="width:140">
    <option value="A" selected="selected">AAA</option>
    <option value="B">BBB</option>
    <option value="C">CCC</option>
    <option value="D">DDD</option>
    </select>
    </tr>
    </table>
    <br/>
    <table width="100%">
    <tr>
    <td valign="top">
    Result: <input type="text" name="txtResult" value="AAA" readonly="readonly" style="width:140;border:0;color:black" />
    </td>
    </tr>
    </table>
    <br/>

    </html>
    </form>
    </td><!-- end main area -->
    </tr></table>
    </div>
    </div></div></body>
    </html>


Comments

  • Registered Users, Registered Users 2 Posts: 21,263 ✭✭✭✭Eoin


    Your HTML is all over the shop to be honest, try the following (you never said what exactly you wanted the page to do, so had to guess):

    edit: this works in Mozilla, so should work in Netscape
    <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
       "http://www.w3.org/TR/html4/loose.dtd">
    
    <html>
    	<head>
    		<title>my page</title>
    		<script type="text/JavaScript">
    			function doValue()
    			{
    				document.myFrm.txt_Entry.value = document.myFrm.lst_Drop.value;
    			}
    		</script>
    	</head>
    	<body>
    		<form name="myFrm" action="thispage.html" method="post">
    			<table>
    				<tr>
    					<td>
    						<select name="lst_Drop" size="3" onChange="doValue()">
    							<option value="AAA">AAA</option>
    							<option value="BBB">BBB</option>
    							<option value="CCC">CCC</option>
    						</select>
    					</td>
    				</tr>
    				<tr>
    					<td>
    						<input type="text" name="txt_Entry" value="AAA" readonly>
    					</td>
    				</tr>
    			</table>
    		</form>
    	</body>
    </html>
    


Advertisement