28, May 2012

IE9 behavior issue with onchange? - webmaster forum

 
Webdigity webmaster forums
[ Home | Help | Search | Forum's Shop | Archive | Login | Register | Webmaster Directory ]
Webdigity Webmaster Forums  >  Web Development  >  JavaScript
Topic: IE9 behavior issue with onchange?
« previous next »
Pages: [1] Print
Instabuck - The easy way to sell digital products online

Author Topic: IE9 behavior issue with onchange?  (Read 827 times)
Google dot what?
*
Posts: 2
16 credits
Members referred : 0


« on: Jan 17, 2012, 05:47:17 pm »

I'm trying to change the selection of one SELECT form based on what the user clicks in another SELECT form.  All the major browsers work as expected except IE9.  Before I reach this code I populate responseText by using PHP.

Code:
if (xmlhttp.readyState==4 && xmlhttp.status==200)
{
var ajaxupdate = document.getElementById('region');
window.alert(xmlhttp.responseText);
ajaxupdate.value = xmlhttp.responseText;
}

The alert gives me the correct data in Chrome/Firefox/Safari but it's empty in IE9.  I'm using this javascript function to respond to the change:

Code:
onchange="showData(this.options[this.selectedIndex].value);"

Any ideas how to get this to work in IE9?

EDIT: Sorry for the edits.  I had to clarify my issue after testing it further.
« Last Edit: Jan 17, 2012, 06:55:59 pm by autoglitch »
Google dot what?
*
Posts: 2
16 credits
Members referred : 0


« Reply #1 on: Jan 19, 2012, 06:03:55 pm »

Fixed.  There wasn't enough code in my description for anyone to figure this out.  The issue was that i'm learning HTML, PHP and javascript using AJAX at the same time. I'm making strange mistakes but I guess that's how you learn.

Here is the original issue.  I've left out the Javascript function and all the PHP because you don't need it.

Code:
//SELECT box 1
<select name="person" id="person" onChange="showData(this.options[this.selectedIndex].value);">
       <option>John</option>
       <option>Jane</option>
</select>

//SELECT box 2
<select name="region" id="region">
       <option>Canada</option>
       <option>US</option>
</select>

Notice my misunderstanding.  'value' is an attribute NOT the text between the tags.  I'm calling for a value that doesn't exist. For some reason, Safari, Chrome and Firefox understand my mistake and do what they think I want.  It's not Microsofts fault this time lol.

Here is the fix:

Code:
//Select box 1
<select name="person" id="person" onChange="showData(this.options[this.selectedIndex].value);">
      <option value="John">John</option>
      <option value="Jane">Jane</option>
</select>

//SELECT box 2
<select name="region" id="region">
      <option value="Canada">Canada</option>
      <option value="US">US</option>
</select>
WebDigity Gangsta
***
Posts: 105
724 credits
Members referred : 0



« Reply #2 on: Mar 21, 2012, 12:19:33 am »

Hehehe replying to your own post Cheesy nice one.
Trackback URI for this entry : http://www.webdigity.com/trackback.php?topic=14250
Tags : ajax php javascript IE9 showData Bookmark this thread : Digg Del.icio.us Dzone more....

Pages: [1] Print 
Webdigity Webmaster Forums  >  Web Development  >  JavaScript
Topic: IE9 behavior issue with onchange?
« previous next »
Jump to:
User Area
Welcome, Guest. Please login or register.
Did you miss your activation email?
May 28, 2012, 06:46:05 am





Login with username, password and session length

Donate to our community, and get a permanent link back to your site!

Donate to our community, and get a permanent link back to your site!


Forum Statistics
Total Posts: 62.845
Total Topics: 11.031
Total Members: 21.454
Tutorials : 58
Resources : 929
Designs : 395
Latest Member: jackson12

130 Guests, 4 Users online :

17 users online today:




Web Design Gallery · Whois Lookup · Pagerank · Tag Browsing · Lo-fi version · Syndication · Webmaster forum history · Advertise
Developed by HumanWorks © 2005 - 2012 Webdigity webmaster community · sublime directory
Webdigity Webmaster Forums | Powered by SMF 1.0.12. © 2001-2005, Lewis Media. All Rights Reserved.