开发者

Need help placing text from 3 list menus into a single text box

I'm new to javascript and all my books are back in the states. I have a dokuwiki website and I want to have 3 list menus ![sample][1] when a user enters a school level it puts the menu value into the textbox when a user enters a grade lev开发者_JAVA百科el it is put in the textbox after the school level and finally the subject is put into the text box after the grade level. I found some sample code that I have been able to get working with only 1 text box but I can not get it to work with all three any thoughts would be greatly appreciated.

<html>    
<script language="JavaScript">

<!-- Begin
function go_to_description() {
if (document.createpage.select.options[0].selected) {
window.location.href = "URL";}
else if (document.createpage.select2.options[1].selected) {
window.location.href = "http://www.google.com";}  
else if (document.createpage.select3.options[2].selected) {
;} 
return true;    
}
function textValue() {   
var searchInteger, searchString       
testInteger=document.createpage.select.selectedIndex 
testString=document.createpage.select.options[testInteger].text
if (testInteger=document.createpage.select.options[0].selected) { 
document.createpage.qsearch__in.value = "Nowhere to GO?";} else {
document.createpage.qsearch__in.value = "" + testString +":"
}
}
// End -->
</script>

<form name="createpage">
      <form action="/dw3/doku.php" accept-charset="utf-8" class="search" id="dw__search" method="input"><div class="no"><input type="hidden" name="do" value="search" />
        <select name="select" on onChange="textValue()" id="select" input type="text">
          <option>Select School Level</option>
          <option value="elementary_school_1st_grade:art:">elementary_school_1st_grade:art</option>
         </select>
        </select><input name="id" type="text" class="edit" id="qsearch__in" accesskey="f" title="[F]" size="40" /><input type="submit" value="Search" class="button" title="Search" /><div id="qsearch__out" class="ajax_qsearch JSpopup"></div></div></form>
      <div class="clearer"></div>
</html>


Are you using multiple selects? your example only shows one.

To get where I think you want to go, you need to store three different values. Try creating three variables, and where you set qsearch__in.value concatenate your variables into one string.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜