Question about javascript

Discuss all aspects of programming here.

Moderator: The Mod Squad

Question about javascript

Postby chrisostomos » Thu Feb 17, 2005 8:12 pm

Hi,

I am wondering how would i change all the values of a drop down list in html with another list of values???

Thanks
chrisostomos
Initiate
Initiate
 
Posts: 79
Joined: Fri Jan 23, 2004 11:13 pm

Postby Toby B. » Thu Feb 17, 2005 8:20 pm

:?

Not quite sure what you are asking. Post the code that you are trying to change and I will see if I can help. Also if you can clearify more on exactly what you needed changed...
Toby B.
Lead Mobo-fu Master
Lead Mobo-fu Master
 
Posts: 14277
Joined: Sun Dec 16, 2001 1:01 am
Location: Maine

Here It Is

Postby chrisostomos » Thu Feb 17, 2005 8:39 pm

Basically I need to make it to change the list of days in the days when month changes.
All i really need to know is how to change the values in the drop down lists all at the same time, perhaps delete them first.
Thanks for the help, was having problems finding a solution




Code: Select all
<html>
<head>

<script type="text/javascript">

function changeDayListValues()
{
}

</script>
</head>

<body>
<form>
Select a Month:
<select name="monthList" onchange="changeDayListValues()">
   <option>January</option>
   <option>February</option>
   <option>March</option>
   <option>April</option>
   <option>May</option>
   <option>June</option>
   <option>July</option>
   <option>August</option>
   <option>September</option>
   <option>October</option>
   <option>November</option>
   <option>December</option>
</select>

<br />

Select a day:
<select name="myList" onchange="put()">
   <option>1</option>
   <option>2</option>
   <option>3</option>
   <option>3</option>
   <option>4</option>
   <option>5</option>
   <option>6</option>
   <option>7</option>
   <option>8</option>
   <option>9</option>
   <option>10</option>
   <option>11</option>
   <option>12</option>
   <option>13</option>
   <option>14</option>
   <option>15</option>
   <option>16</option>
   <option>17</option>
   <option>18</option>
   <option>19</option>
   <option>20</option>
   <option>21</option>
   <option>22</option>
   <option>23</option>
   <option>24</option>
   <option>25</option>
   <option>26</option>
   <option>27</option>
   <option>28</option>
   <option>29</option>
   <option>30</option>
   <option>31</option>
</select>

</form>
</body>

</html>
chrisostomos
Initiate
Initiate
 
Posts: 79
Joined: Fri Jan 23, 2004 11:13 pm

Postby Toby B. » Thu Feb 17, 2005 9:16 pm

Might have to wait til MoboCop gets back, but I will see what I can do in the meantime...

Does your webhost allow php?
Toby B.
Lead Mobo-fu Master
Lead Mobo-fu Master
 
Posts: 14277
Joined: Sun Dec 16, 2001 1:01 am
Location: Maine

Reply

Postby chrisostomos » Thu Feb 17, 2005 9:32 pm

No, there is no php, its basically for school not for web hosting.
thanks
chrisostomos
Initiate
Initiate
 
Posts: 79
Joined: Fri Jan 23, 2004 11:13 pm

Re: Reply

Postby Toby B. » Thu Feb 17, 2005 9:39 pm

chrisostomos wrote:No, there is no php, its basically for school not for web hosting.
thanks


Well since it is a school project, I will only offer suggestions. And bear in mind javascript is not my strong point!

Look into if/else if statements. If I remember correctly javascript can handle those.
Toby B.
Lead Mobo-fu Master
Lead Mobo-fu Master
 
Posts: 14277
Joined: Sun Dec 16, 2001 1:01 am
Location: Maine

Postby chrisostomos » Thu Feb 17, 2005 9:45 pm

Bascially the problem i have is i dont know how to change the values in the drop down list. I need to delete them all and then put them in.
chrisostomos
Initiate
Initiate
 
Posts: 79
Joined: Fri Jan 23, 2004 11:13 pm

Postby Toby B. » Thu Feb 17, 2005 10:15 pm

chrisostomos wrote:Bascially the problem i have is i dont know how to change the values in the drop down list. I need to delete them all and then put them in.


Figure out what months have x amount of days and setup a statement. Then proceed to the next group of months with x amount of days. And so on.

Basically you want to create a group association. A particular letter/number/symbol represents a certain number of days. And associate that particular character to an optin in the months menu. So when you select for example January you will see 31 days in the "days menu" and so on.

Since this is a school project I am assuming you must have or have access to text books for learning javascript. Not trying to be rude, but the best way to learn is by doing it. Trial and error often returns great results..
Toby B.
Lead Mobo-fu Master
Lead Mobo-fu Master
 
Posts: 14277
Joined: Sun Dec 16, 2001 1:01 am
Location: Maine

Postby chrisostomos » Fri Feb 18, 2005 8:42 am

Its ok your not rude, but we dont have a textbook for this course. We are suppose to use the internet.

I know how to use if statements to do everything but i just dont know how to addElements or removeElements to the list

thats the one thing i dont know how to do. Or is there a way to remove all elements from the drop Down List or to add an array of strings to the list

Thanks !!!
chrisostomos
Initiate
Initiate
 
Posts: 79
Joined: Fri Jan 23, 2004 11:13 pm


Return to Programming

Who is online

Users browsing this forum: No registered users and 1 guest