473,320 Members | 1,955 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,320 software developers and data experts.

Onchange event in javascript and Html dropdown

Hello
I write a function in javascript for selecting a div when the user changes the input in radio button and dropdown menu

Myjavascript function is

function setState( abbrev )
{

if ( abbrev == "" || window.document.frm.selectdropdown.options.selecte dIndex == 0 )
{
parent.content.location.href = "corp_name_top.html" ;
} else
{
if (window.document.frm.nrr[0].checked == true)
{
parent.content.location.href = abbrev.toLowerCase() + ".html" ;
}
else
{
parent.content.location.href = abbrev.toLowerCase() + "_reg.html" ;
}
}
}
Sindex=0;

// This function determines the selected state and passes it to the setState function.
function changeState(selectedindex)
{
alert('hi');
Sindex = window.document.frm.selectdropdown.selectedIndex;
setState( window.document.frm.selectdropdown[Sindex].getattributes(value))
}

And my HTML code is

<p>An outline of requirements to reserve and protect a corporate name, by jurisdiction. Please select from the following options:</p>
<br />
<input type="radio" name="nrr" value="res" style="background : #cccccc; color: #000000;" onclick="setState(self.document.frm.Jurisdiction.o ptions[window.document.frm.Jurisdiction.selectedIndex].value)" checked="checked" />Reservation *
<input type="radio" name="nrr" value="reg" style="background : #cccccc; color: #000000;" onclick="setState(self.document.frm.Jurisdiction.o ptions[window.document.frm.Jurisdiction.selectedIndex].value)" />Registration<br />
<br />


<div class="contentBoxHeader">
<h3>Name Reservation & Registration</h3>
</div>

<select name="selectdropdown" onchange="changeState();">
<option value=" " selected="selected">Select a Jurisdiction:</option>


the error i got is window.document.form.selectdropdown is null or not an object

Please any one clarify what maistake i have made
Jun 7 '07 #1
1 5378
iam_clint
1,208 Expert 1GB
try
Expand|Select|Wrap|Line Numbers
  1. window.document.frm.selectdropdown 
  2.  
Jun 7 '07 #2

Sign in to post your reply or Sign up for a free account.

Similar topics

2
by: Phil Powell | last post by:
I have a form with two single-choice dropdowns. Upon doing an onChange event on either one of them, I want to check to see if the other dropdown has also been selected. How would I do that,...
2
by: Mark Durgee | last post by:
I have a "submit" button in a form that creates a record in my Filemaker database that works as it should. This is the HTML for it: <INPUT TYPE="SUBMIT" name="-New" VALUE="Add Record"> I...
1
by: Covad | last post by:
Hi all, For some reason my change() function is only called when the page loads. I'd much rather it gets called when the select changes. Here's the code: window.onload = init; function...
3
by: DaveF | last post by:
I need to capture a selected value of the onchange dropdown and put it in a textbox??? -- Dave
3
by: jab3 | last post by:
Hello. I"m new to this group, and to JavaScript in general, so please forgive me if I breach local etiquette. I'm trying to implement some client-side 'dynamic' validation on a form. I'm having...
3
by: countocram | last post by:
hi! Im having a problem retaining the inputs on my text fields. When i selected an option from a dropdown list with an onChange=location.. event. What happen is that, everytime I choose an option the...
3
by: Mister Joe | last post by:
I have a page and if the user has javascript enables I am trying to dynamically change a link to a sitemap to a dropdown menu (that when the option is changed will forward the user to another...
4
by: auslandt | last post by:
I have an HTML file that includes a JavaScript. I would like this JavaScript to be able to create an "onChange=<function>" attribute against the password element. Here is an example page of the...
21
by: Leena P | last post by:
i want to basically take some information for the product and let the user enter the the material required to make this product 1.first page test.php which takes product code and displays...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
1
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.