/    Sign up×
Community /Pin to ProfileBookmark

IE problem, firefox works ok

Hello! I saw some pretty competent people replying here so I`ll post my question. This is my HTML code:

[code]
<select size=”5″ name=”model”>
<optgroup label=”Class C”>
<option onclick=”javascript:ajaxpage(‘http://test.rentabenz.ro/images/cars/g.php?c=c-2001’, ‘img_right’);” value=”C 2001-2003″>Model 2001-2003</option>
<option onclick=”javascript:ajaxpage(‘http://test.rentabenz.ro/images/cars/g.php?c=c-2004’, ‘img_right’);” value=”C 2004-2007″>Model 2004-2007</option>
</optgroup>
<optgroup label=”Class E”>
<option onclick=”javascript:ajaxpage(‘http://test.rentabenz.ro/images/cars/g.php?c=e-2001’, ‘img_right’);” value=”E 2001-2003″>Model 2001-2003</option>
<option onclick=”javascript:ajaxpage(‘http://test.rentabenz.ro/images/cars/g.php?c=e-2004’, ‘img_right’);” value=”E 2004-2007″>Model 2004-2007</option>
</optgroup>
<optgroup label=”Class S”>
<option onclick=”javascript:ajaxpage(‘http://test.rentabenz.ro/images/cars/g.php?c=s-2001’, ‘img_right’);” value=”S 2001-2003″>Model 2001-2003</option>
</optgroup>
<optgroup label=”Class V”>
<option onclick=”javascript:ajaxpage(‘http://test.rentabenz.ro/images/cars/g.php?c=v-2001’, ‘img_right’);” value=”V 2001-2003″>Model 2001-2003</option>
<option onClick=”javascript:ajaxpage(‘http://test.rentabenz.ro/images/cars/g.php?c=v-2004’, ‘img_right’);” value=”V 2003-2007″>Model 2004-2007</option>
</optgroup>
</select><br />

[/code]

And this is the Javascript:

[code]
var loadedobjects=””
var rootdomain=”http://”+window.location.hostname

function ajaxpage(url, containerid){
var page_request = false
if (window.XMLHttpRequest) // if Mozilla, Safari etc
page_request = new XMLHttpRequest()
else if (window.ActiveXObject){ // if IE
try {
page_request = new ActiveXObject(“Msxml2.XMLHTTP”)
}
catch (e){
try{
page_request = new ActiveXObject(“Microsoft.XMLHTTP”)
}
catch (e){}
}
}
else
return false
page_request.onreadystatechange=function(){
loadpage(page_request, containerid)
}
page_request.open(‘GET’, url, true)
page_request.send(null)
}

function loadpage(page_request, containerid){
if (page_request.readyState == 4 && (page_request.status==200 || window.location.href.indexOf(“http”)==-1))
var containerid = document.getElementById(containerid).innerHTML=page_request.responseText
}
[/code]

My problem is that in FF the onClick function for <option> works, the pages are loaded correctly with AJAX in a <div>, but in IE does nothing. Do you know how to modify the script or the html, or both, to get it working in IE too ? Thanks very much!

to post a comment
JavaScript

1 Comments(s)

Copy linkTweet thisAlerts:
@FangAug 25.2007 — onclick does not work in [I]option[/I] in IE, use onchange in the [I]select[/I]
×

Success!

Help @theb3s7 spread the word by sharing this article on Twitter...

Tweet This
Sign in
Forgot password?
Sign in with TwitchSign in with GithubCreate Account
about: ({
version: 0.1.9 BETA 5.24,
whats_new: community page,
up_next: more Davinci•003 tasks,
coming_soon: events calendar,
social: @webDeveloperHQ
});

legal: ({
terms: of use,
privacy: policy
});
changelog: (
version: 0.1.9,
notes: added community page

version: 0.1.8,
notes: added Davinci•003

version: 0.1.7,
notes: upvote answers to bounties

version: 0.1.6,
notes: article editor refresh
)...
recent_tips: (
tipper: @AriseFacilitySolutions09,
tipped: article
amount: 1000 SATS,

tipper: @Yussuf4331,
tipped: article
amount: 1000 SATS,

tipper: @darkwebsites540,
tipped: article
amount: 10 SATS,
)...