...

View Full Version : Help for fixing a code



letchev
08-29-2010, 06:22 PM
Hi,

I donīt know as fix the variable "i". Any help would be appreciated.


<form method="get" name="form1">
<select name="teams">
<OPTION VALUE="http://www.cdc.gov/obesity/causes/economics.html">Obesity
<OPTION VALUE="http://www.despair.com/economics.html">Economics
<OPTION VALUE="http://nobelprizes.com/nobel/economics/">Nobel
<OPTION VALUE="http://ideas.repec.org/s/rio/texdis.html">Economia
<OPTION VALUE="http://www.cervantesvirtual.com">Cervantes Virtual
</select>
</form>
<br>

<script type="text/javascript" language="javascript">
if (i=<document.form1.teams.options.length;){
document.write('<input type=text + value="' + document.form1.teams.options[i].value +'">');
}
</script>

Letchev

jmrker
08-29-2010, 06:46 PM
What is it that you are trying to do? :confused:
This is just a guess! :eek:



<form method="get" name="form1">
<select name="teams">
<OPTION VALUE="http://www.cdc.gov/obesity/causes/economics.html">Obesity
<OPTION VALUE="http://www.despair.com/economics.html">Economics
<OPTION VALUE="http://nobelprizes.com/nobel/economics/">Nobel
<OPTION VALUE="http://ideas.repec.org/s/rio/texdis.html">Economia
<OPTION VALUE="http://www.cervantesvirtual.com">Cervantes Virtual
</select>
</form>
<br>

<script type="text/javascript" language="javascript">
var i=0;
do {
document.write('<input type=text + value="' + document.form1.teams.options[i].value +'">');
i++;
} while (i<document.form1.teams.options.length);
</script>

DaveyErwin
08-29-2010, 07:19 PM
heres my guess ...


<script type="text/javascript">
var teamSelected = function(){
document.getElementById("displayTeam").innerHTML=
" selected item number = " +
document.forms["form1"].elements["teams"].selectedIndex +
"<br> selected option = " +
document.forms["form1"].elements["teams"].options[document.forms["form1"].elements["teams"].selectedIndex].text +
"<br> selected value = " +
document.forms["form1"].elements["teams"].options[document.forms["form1"].elements["teams"].selectedIndex].value;
}
</script>




<form method="get" name="form1">
<select name="teams" onchange="teamSelected()">
<OPTION VALUE="http://www.cdc.gov/obesity/causes/economics.html">Obesity
<OPTION VALUE="http://www.despair.com/economics.html">Economics
<OPTION VALUE="http://nobelprizes.com/nobel/economics/">Nobel
<OPTION VALUE="http://ideas.repec.org/s/rio/texdis.html">Economia
<OPTION VALUE="http://www.cervantesvirtual.com">Cervantes Virtual
</select>
</form>
<br>
<div id="displayTeam"></div>

letchev
08-29-2010, 07:50 PM
Thank you for jmrker and DaveyErwin,

Regarding the question of jmrker, behind the scene there is other code...

I would need help to fix just the different links in one input only. At the present time except by the code of DaveyErwin (but it not works fine with the rest of the code. Alone yes) , the links are shown in inputs as much as links and I need in other way: several links in one input.

Obs: The options menu is changed automatically by settimeout. Each 10 seconds is shown 1 link in the INPUT... but this is subject for other thread!


Letchev



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum