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 Quote Link to comment 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? Quote Link to comment 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 Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.