Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations TouchToneTommy on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

list box problem

Status
Not open for further replies.

1000kisoen

IS-IT--Management
Aug 12, 2004
37
NL
hi there have some problem with this script please help me out
<html>
<head>
<title></title>
<meta name="author" >
<script language="javascript">
function displ()

{
//if the forms element is 0 (the first one) then return false; do nothing.

if(document.myFORM.valu.options[0].value == true) {

return false

}

else

{
//otherwise, place the appropriate <option value> in the texfield from the drop-down menu.

document.myFORM.textfield.value=document.myFORM.valu.options[document.myFORM.valu.selectedIndex].value;

}

return true;

}

function CallDate(selectedValue)

{

if (selectedindex = >90 )

{

var currDate = new Date();

var currMonth = currDate.getMonth()+1;

document.myFORM.textfield.value = currDate.getDate()+"-"+currMonth+"-"+currDate.getYear();

}

else

document.myFORM.textfield.value = "";
}
</script>
</head>
<body bgcolor="#FFFFFF" text="#000000">
<table border="0" cellspacing="0" cellpadding="0" width="25%">
<tr>
<td width="100%">
<form name="myFORM" >
<select name="valu" size="1" onchange="CallDate(this.value)">
<option value="Choose">Choose One</option>

<option value="10">open</option>

<option value="90">closed</option>

<option value="20">On hold</option>
</select>
<input type="text" name="textfield" readonly>
</form>
</td>
</tr>
</table>
</body>
</html>

can anyone assist me
kisoen
 
I changed your code around. additionally, i'm wondering what you're doing with the displ() function, since it's not called anywhere in your page???

Code:
<html>
<head>
<title></title>
<meta name="author" >
<script language="javascript">
function displ() {
    var the_sel = document.forms['myFORM'].elements['valu'];
	var the_txt = document.forms['myFORM'].elements['textfield'];
	var the_val = the_sel.options[the_sel.selectedIndex].value;

    //if the forms element is 0 (the first one) then return false; do nothing.
    if(the_val == '') {
        return false;
    } else {
    //otherwise, place the appropriate <option value> in the texfield from the drop-down menu. 
        the_txt.value = the_val;
    }
    return true;
}

function CallDate() {
    var the_sel = document.forms['myFORM'].elements['valu'];
	var the_txt = document.forms['myFORM'].elements['textfield'];
	var the_val = the_sel.options[the_sel.selectedIndex].value;
    if (the_val == 90 ) {           
        var currDate = new Date();                     
        var currMonth = currDate.getMonth()+1;
        the_txt.value = currDate.getDate()+"-"+currMonth+"-"+currDate.getYear();
    } else {
	    the_txt.value = "";
    }
}
</script>
</head>
<body bgcolor="#FFFFFF" text="#000000">
<table border="0" cellspacing="0" cellpadding="0" width="25%">
<tr>
    <td width="100%">
      <form name="myFORM">
        <select name="valu" size="1" onchange="CallDate()">
          <option value="">Choose One</option>

          <option value="10">open</option>

          <option value="90">closed</option>

          <option value="20">On hold</option>
        </select>
        <input type="text" name="textfield" readonly>
      </form>
    </td>
  </tr>
</table>
</body>
</html>

*cLFlaVA
----------------------------
Lois: "Peter, you're drunk!"
Peter: "I'm not drunk, I'm just exhausted from stayin' up all night drinking!
 
yeh you are quite right should be deleted
thanks changing the code for me
but it should ben greater than 90 (>90)

I changed it into >90 but it working could advise me how I changed this.
thx kisoen
 
There are no instances where the value is greater than 90. Look here:

<select name="valu" size="1" onchange="CallDate()">
<option value="">Choose One</option>

<option value="10">open</option>

<option value="90">closed</option>

<option value="20">On hold</option>
</select>


Your possible values are blank (""), 10, 90, and 20. How will it ever be greater than 90?

*cLFlaVA
----------------------------
Lois: "Peter, you're drunk!"
Peter: "I'm not drunk, I'm just exhausted from stayin' up all night drinking!
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top