dynamic text with drop down..

A

ananttickoo

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.

any can hep m ot
 
A

ASM

(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)
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,769
Messages
2,569,581
Members
45,056
Latest member
GlycogenSupporthealth

Latest Threads

Top