470,635 Members | 2,062 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 470,635 developers. It's quick & easy.

dynamic text with drop down..

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

Dec 9 '06 #1
1 1451
ASM
an*********@gmail.com 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)

--
Stephane Moriaux et son (moins) vieux Mac déjà dépassé
Stephane Moriaux and his (less) old Mac already out of date
Dec 9 '06 #2

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

5 posts views Thread by C White | last post: by
2 posts views Thread by Michael | last post: by
3 posts views Thread by scaredemz | last post: by
2 posts views Thread by Jim Gregg | last post: by
9 posts views Thread by Tarscher | last post: by
1 post views Thread by Korara | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.