(e-mail address removed) a écrit :
i am trying to display text in which when i selet any option in drop
down and click submit. text regarding that gets displayed below that
drop down.
i am able to display text but its next page.
<form action="error_js.htm" onsubmit="return displayText();" name="f1">
<select name="s1" ... >
<opti ...
</select>
<p id="info">?</p>
<input type=submit value="see">
</form>
JS :
====
function displayText() {
var S = document.forms['f1'].elements['s1'];
var txt = S.options[S.selectedIndex].value;
document.getElementById('info').innerHTML = txt;
return false;
}
The onsubmit waits result of function displayText()
which returns 'false'
so form's action is avoid.
If JS is disabled, the file 'error_js.htm' is displayed and explain JS
must be enabled.
(or you can have a php file which will do the job)