Javascript - Open new URL and transfer data based on two form values

I'm completely new to javascript, but I'm trying to create a beta form for a focus group test. The end product will be professionally developed, but I need a short term, functioning solution. It only has to function one time on one computer, so I can use any method (cookies, webstorage, etc.) to transfer data between pages.

I have a form with a ddl with 10 options. For example:

<select name="sector" id="sectorchoice"><option value="religion">Religion</option><option value="health">Health</option></select>

I also have a radio button that will open one of two URLs depending on whether or not it is checked (onclick="greport"() through submit button).

 <script>
function greport() {
    if (document.getElementById('radio1').checked = true) {
        window.open ("http://www.sampleurl.com","mywindow");
    }

    if (document.getElementById('radio1').checked = false) {
        window.open ("http://www.sampleurl2.com","mywindow");
    }
}

I need to load one of nine images on sampleurl.com and sampleurl2.com based on the "sectorchoice" value in the first dropdown. How can I transfer the value and create a function to open the correct image? Thanks.

Answers


= and == are two different things.

= the assignment operator

var box = "A Big Box";

== is the comparison operator, and the statement returns a boolean

a == b 

so you will make this change in your code

document.getElementById('radio1').checked == true

Need Your Help

Load a .rtf File into a RichTextBox and Maintain/Persist the Formatting

c# winforms richtextbox richtext

All, I write a log file to a .rtf file which has formatting underlining, bold etc. I have saved this file and want to read it back into the RichTextBox at a later time persisting its formatting. I ...

SQL Query based on occurrence of records

sql-server sql-server-2005

After a long time, I am getting a chance to post a SQL Server question here.