Just a heads up, I'm pretty new to coding and am doing simple assignments for my schooling. So take it easy on me please. :-)
So one of my problems is to create a webpage with an array holding all the planet names. I did that fairly easily.
<script>
var planets = ["Mercury", "Venus", "Earth", "Mars", "Jupiter", "Saturn", "Uranus", "Neptune", "Pluto"];
</script>
So far, so good. The next step asks to use the array to display the names of the planet in a select object. I also managed to get this to work, though it took a little bit of messing around.
Planets
<select id="planetSelect">
<script>
for (var p = 0; p < 9; ++p) {
document.write("<option value='p'>");
document.write(planets[p]);
document.write("</option>");
}
</script>
</select>
Got it. Now my page displays a little drop-down menu with all the planet names... Now the last step is to have the web page display the amount of moons and gravitational factor of the planets when selected in the drop down. (This info can be easily googled, not the issue I'm having.) I'm not sure how to tie the info to the drop-down selection/array properly and have it display. At a loss of how to get this started and going. Any help is appreciated! :-)