OVERVIEW:
I'm coding a HTML page to display a dropdown menu and based on the option selected some input fields will be enabled and some disabled, but to do this I used the value field for (value="production_report"), and therefore I can't use it to add the line (value="index.html"), so when my button "build report" is clicked it loads the link (index.html).
QUESTION:
so I'm adding into my JavaScript function an onClick method to load the link when the button is pressed in my HTML form. So my question is, Is it possible to use an onClick() function like this???(Code below), and how would I do this???, I've tried the below. Any help would be much appreciated thanks.
JavaScript FUNCTION:|
---------------------
if (comp.value == 'production_report') {;
document.getElementById("build").onclick("location.href='index.html'");
}
else if (comp.value == 'please_select') {;
document.getElementById("build").onclick("location.href='home.html'");
}
HTML Button code: |
-----------------
<input type="button" value="Build Report" onclick="???" id="build">