Flash Games
 FAQ   Search   Memberlist   Usergroups   Register  Profile   Log in to check your private messages   Log in 


Option value input problem



 

Post new topic   Reply to topic  
   DEVPPL Forum Index -> JavaScript Forum
View previous topic :: View next topic  
Author Message
Strongbad



Joined: 16 Nov 2006
Posts: 1

PostPosted: Thu Nov 16, 2006 6:35 pm    Post subject: Option value input problem Reply with quote

I'm trying to get this function working, so that when a user choose a value from the drop-down meny, the appropriate textbox is shown. To do this I'm using this script to unhide the selected area, with the div id as an in-paramterer.

Quote:
function switchSearch(divID) {
var coll = document.all.tags("DIV");
if (coll != null) {
for (i=0; i<coll.length; i++) {
coll[i].style.display = "none";
}
}

meny.style.display = "";
search.style.display = "";
divID.style.display = "";
div1.style.display = "none";
}

The red code is the problem.
Quote:
<div id="search">
<ul>
<form action="resultatsoek.php" method="post">

<select name="soektype" onChange="switchSearch(this.options[this.selectedIndex].value);">

<option value="div1">List alle</option>
<option value="div2">ISBN</option>
<option value="div3">Forfatter</option>
<option value="div4">Tittel</option>
<option value="div5">Eier</option>

</select><br /><br />

<div class="empty" id="div1" style="display: none">
<input name="div1" type="text"></div>

<div class="empty" id="div2" style="display: none">
<input name="div2" type="text"></div>

<div class="empty" id="div3" style="display: none">
<input name="div3" type="text"></div>

<div class="empty" id="div4" style="display: none">
<input name="div4" type="text"></div>

<div class="empty" id="div5" style="display: none">
<input name="div5" type="text"></div>

<input type="submit" value="Søk"></form>

<a href="#" onclick="javascript: switchSearch(div3);">click here to toggle</a>
</div>

The red code in the switchSearch script-function works with the "ahref-oncklick" where you insert a premade variable, but not with the red onchange dynamic script-call, even though it should give the same variable in to the script. It even shows the right value when I use document.write(divID) in the script.

Any help would be appreciated.
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic    DEVPPL Forum Index -> JavaScript Forum All times are GMT + 1 Hour
Page 1 of 1

 
 
Welcome to DEVPPL.com
You are not logged in, which means that you can't post in the forums.
Click here to Register

If you are a current member here on DEVPPL, please login below:

User: Pass:
Log me on automatically each visit:

 


Powered by phpBB © 2001, 2005 phpBB Group - Modified by DEVPPL

Flash Games - Sitemap