Hello,
I am not sure the exact forum policy on helping with programming assignments, but I will take it on faith that you have done the rest of the assignment.
For your first problem of redirect the web browser, you can use the "location.replace" function, an example that I tested was:
<!-- start HTML snippet -->
<FORM METHOD=POST>
<INPUT TYPE=button NAME="redirect" VALUE="redirect" onClick="location.replace('
http://www.google.com');"><BR>
</FORM>
<!-- End HTML snippet -->
You can see the use of the location.replace function call to go to www.google.com when the button is clicked.
For your second problem, I will show a short demo of how to get, work with and comparison of values returned from select lists in javascript. Here is the html for my little select list:
<SELECT NAME="example">
<OPTION SELECTED VALUE="1">One
<OPTION VALUE="2">Two
<OPTION VALUE="3">Three
</SELECT>
When this list is first displayed, you have these following variables at your fingertips:
example.options[1].value = "1"
exampe.options[2].text = "Three"
example.selectedIndex = 0 (This is the selected value from our list, I made the first value [index 0] the default selection)
example.options[0].selected = true
So, if then clicked on the "Three" select option, the following variable values would change:
example.selectedIndex = 2
example.options[2].selected = true
example.options[example.selectedIndex].value = "3"
So to use this information if an if statement:
dAdd = example.options[example.selectedIndex].value;
dAdd_text = example.options[dAdd].text;
if (dAdd == 0 || dAdd_text == "One") { // do something }
else {dAdd == 1 || dAdd_text == "Two") { // do something}
etc....
Hope that helps!
Cheers,
Tom
okay i skipped a bunch of classes so i have learnt no javascript, have an assignment and im almost done i just need to know two very simple things,
Ive got a button, i know how to call a function but what i need is a javascript function that will direct the browser to a different webpage, we'll say for example www.google.com, it must be in javascript, those are the project requirements
Also, on anothre page i have a drop down box, i need an ifstatement for each of its options,
there are 10 options, we'll say for now that option 1 is "1", option 2 is "2", etc. and the drop box is named dAdd so far ive get
function drop()
{
if (dAdd== (sometihing))
{
}
}
what do i need to put in the place of (something) if i want option 1?
I know these questions are simple and ill probably get laughed at, but remember yesterday i knew nothing about javascript, today these two problems are all thats in my way to finish my assignment
any help would be appreciated,
cheers,
Ben