0

Okay so I'm pretty basic when it comes to codes but we have to make a webpage for my computer science class at school, one section including previous class schedules. I'll simplify it to this: I have a navigation bar across the top and one option (schedules) has a drop down menu to a few sub-options (past years).If you click the main option, it links to a page (schedules.html) where there are buttons.Those buttons run a simple script of displaying pictures of previous class schedules that are embedded right below the buttons [so far all of this works how I want it to]

What I can't find out how to do is make the drop-down options (past years) link to the schedules page, then run the script of displaying the picture once it's loaded. Again, it's probably because I'm really new to this. But here's what I have:

HTML


         <li><a href="schedules.html">Class Schedules</a>
            <ul>
               <li><a href="?">2015</a></li> 

<!--want to happen: when select a year, loads schedule page then loads the schedule for that year, -->

               <li><a href="?">2014</a></li>
               <li><a href="?">2013</a></li>
               <li><a href="?">2012</a></li>
            </ul>         
         </li> 

The buttons to display the schedules I set in a simple table:

<tr> 
    <td>2015</td>
    <td><input type="button" value="Fall"onClick="pic1()"/></td>
    <td><input type="button" value="Spring"onClick="pic2()"/></td>
</tr>   

And the script for the pictures:

<script type = "text/javascript">
    function pic1() /*fall 2015*/
    {
        document.getElementById("schedule").src = "fall15.png";
    }

    function pic2() /*spring 2015*/
    {
        document.getElementById("schedule").src ="spring15.png";
    } 

etc...

<img src = "" id = "schedule"/> <!--place where the image goes-->

If this has been answered somewhere, I apologize. I looked for a few days but I'm not sure what it is I'm looking for. I didn't include the CSS code in here because I didn't think it would affect the answer, but the CSS is linked to a style sheet if that's worth anything.

Mitch Wilson
  • 109
  • 10