...

View Full Version : Javascript function return value ... how to use that



madhu542
09-04-2007, 08:13 AM
Hai...

I created one drop down list box with enable and disable options. if enable is selected and click submit then it has to display 'changed from disabled', for this I wrote one javascript function with this, if I want to display the value on the text box then it is working fine. But I am not able to display the same value in the table. I am send the sample code here...


plz see below commented code is to display the value in the text box. Now I am tring with the table option. I have to display these values in the table anyhow. Any one plz help me. I stuck here...

<html>
<head>
<title> example</title>
<script type="text/javascript">
function moveNumbers()
{
var no=document.getElementById("no")
var option=no.options[no.selectedIndex].text
var txt=document.getElementById("result").value
if (option =="Enable")
var tt="Changed from Disable"
else
tt="Changed from Enable"

document.getElementById("result").value=tt
}
</script>
</head>
<body>

<form>
<table border=2>
<caption>Configuration</caption>
<tr>
<td> <select id="no">
<option>Enable</option>
<option>Disable</option>
</select>
</td>
<td id="result"> </td>
</tr>
</table>
<br>
<input type="button" onclick="moveNumbers()" value="Submit">
<!--<input type="text" id="result" size="20"> <!--commented code-->
<table border=2>
<tr><th id="result">hai</th>
<td>hello</td>
</tr>
</table> -->
</form>

BarrMan
09-04-2007, 08:55 AM
Try .innerText instead of .value.



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum