Canman2005 Posted October 22, 2008 Share Posted October 22, 2008 Hi all I'm using the following script to pull the contents of a page into a SPAN tag function ajaxLoader(url,id) { if (document.getElementById) { var x = (window.ActiveXObject) ? new ActiveXObject("Microsoft.XMLHTTP") : new XMLHttpRequest(); } if (x) { x.onreadystatechange = function() { el = document.getElementById(id); el.innerHTML = ""; if (x.readyState == 4 && x.status == 200) { el = document.getElementById(id); el.innerHTML = x.responseText; } } x.open("GET", url, true); x.send(null); } } the SPAN is created with <span id="myspan"></span> and then I do the link to pull in content using <a onclick="ajaxLoader('mypage.php','myspan');"> This works great as a normal text link and in FireFox I don't get any problems using it anywhere. The issue I have is using it in a list menu in IE, if I apply the onclick to <select name="list" onmousedown="ajaxLoader('mypage.php','myspan');"> <option value="">Option 1</option> <option value="">Option 2</option> </select> then it works fine, but if I apply it like <select name="list"> <option onmousedown="ajaxLoader('mypage.php','myspan');" value="">Option 1</option> <option onmousedown="ajaxLoader('mypage.php','myspan');" value="">Option 2</option> </select> then it refuses to work. Any ideas why issues in IE? Help Thanks Ed Link to comment https://forums.phpfreaks.com/topic/129553-ajax-loader-issue/ Share on other sites More sharing options...
Canman2005 Posted October 22, 2008 Author Share Posted October 22, 2008 I have been trying things like the action name, so trying onmousedown onclick onchange and none of those seems to respond. Do I need to alter the script or are my actions just incorrect? Link to comment https://forums.phpfreaks.com/topic/129553-ajax-loader-issue/#findComment-671733 Share on other sites More sharing options...
RichardRotterdam Posted October 23, 2008 Share Posted October 23, 2008 the correct way on using a select element is using the onchange <select onchange="js_function(this.value)"> </select> the this.value will pass the value to the function i think that will do the trick Link to comment https://forums.phpfreaks.com/topic/129553-ajax-loader-issue/#findComment-672707 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.