What is wrong with this code in IE, rest of the browsers its working fine, but when it comes to IE, it gives an error popup, Access is denied. Can some one help please.

var IE = false;
	if (navigator.appName == "Microsoft Internet Explorer"){IE = true}
	if (!IE){document.captureEvents(Event.MOUSEMOVE)}
	document.onmousemove = getMouseXY;
	var mouse_position_x = 0;
	var mouse_position_y = 0;
	var screen_height = 0;
	var screen_width = 0;
	if (IE)	
	{
		screen_height 		= document.documentElement.clientHeight;
		screen_width 		= document.documentElement.clientWidth;
	}
	else
	{
		screen_height 		= window.innerHeight;
		screen_width 		= window.innerWidth;
	}
	
	function getMouseXY(m)
	{
  		if (IE)	
		{
			 var tmpX = event.clientX;
  			 var tmpY = event.clientY;
		}	
 		else 	
		{
    		 var tmpX = m.pageX;
			 var tmpY = m.pageY;
  		}  
		if (!document.body.scrollTop)
		{
			 var iL = document.documentElement.scrollLeft;	
			 var iV = document.documentElement.scrollTop;
		}
		else 	
		{
			 var iL = document.body.scrollLeft;	
			 var iV = document.body.scrollTop;	
		}
		if (IE)	
		{
			mouse_position_x 	= tmpX ; 
			mouse_position_y 	= tmpY ;
		}
		else
		{
			mouse_position_x 	= tmpX - iL; 
			mouse_position_y 	= tmpY - iV;
		}
  	}
	
	var contact_us_click = 0;
	function contact_up_popup()
	{
		if(contact_us_click == 0)
		{
			contact_us_click = 1;
			chat_popup_function_visible();
		}
		else
		{
			contact_us_click = 0;
			chat_popup_function_hidden();
		}
	}
	function chat_popup_function_visible()
	{
		document.getElementById("chat_popup").style.left = (screen_width - 210)+"px";
		document.getElementById("chat_popup").style.top = (screen_height / 4)+"px";
		//document.getElementById("chat_popup").style.visibility = 'visible'; 
	}
	function chat_popup_function_hidden()
	{
		//document.getElementById("chat_popup").style.visibility = 'hidden'; 
		load_script();
	}
	function load_script()
	{
		document.getElementById("chat_popup").style.left = (screen_width - 40)+"px";
		document.getElementById("chat_popup").style.top = (screen_height / 4 )+"px";
	}
	function checkValidation()
	{
		if(document.getElementById("UserName").value == "")
		{
			return false;
		}
		else if(checkMobileNo(document.getElementById("Mobile").value) == false)
		{
			alert("Please enter mobile no.");
			return false;
		}
		else if(document.getElementById("Message_temp").value == "")
		{
			alert("Please enter message");
			return false;
		}
		else
		{
			document.getElementById("Message").value = document.getElementById("Mobile").value+":"+document.getElementById("Message_temp").value;
			send_message();
			alert("This message can only be sent to us. This message is being sent to us.");
			return true;
		}
	}
	function checkMobileNo(mobile_no)
	{
		var y = mobile_no;	
		if(isNaN(y)||y.indexOf(" ")!=-1)
		{
			return false; 
		}
		if (y.length!=10)
		{
			return false;
		}
		return  true;
	}
	function GetXmlHttpObject()
	{
		if (window.XMLHttpRequest)
		{
			// code for IE7+, Firefox, Chrome, Opera, Safari
			return new XMLHttpRequest();
		}
		if (window.ActiveXObject)
		{
			// code for IE6, IE5
			return new ActiveXObject("Microsoft.XMLHTTP");
		}
		return null;
	}
	function send_message()
	{
		xmlhttp=GetXmlHttpObject();
		if (xmlhttp==null)
		{
			alert ("Your browser does not support XMLHTTP!");
			return;
		}
		xmlhttp.onreadystatechange=stateChangedsend_message; 
		xmlhttp.open("POST", "http://www.smsgatewaycenter.com/library/contact_us_send_TollFreeSms.php?UserName="+document.getElementById("UserName").value+"&Message="+document.getElementById("Message").value,true);
		xmlhttp.send(null);
	}
	function stateChangedsend_message()
	{
		if (xmlhttp.readyState==4)
		{
			document.getElementById("form").innerHTML = xmlhttp.responseText;
			document.getElementById("form").innerHTML = "Your message send successfully.";
		}
		else if (xmlhttp.readyState == 1)
		{
			document.getElementById("form").innerHTML = "<img src=\"http://www.smsgatewaycenter.com/images/loader.gif\" />";
		}
	}
	function message_length()
	{
		var message_length = 0;
		var maxlimit = 148;
		var message = "";
		message_length = document.getElementById("Message_temp").value.length + 1;
		if(message_length >= maxlimit)
		{	
			document.getElementById("Message_temp").value = document.getElementById("Message_temp").value.substring(0, maxlimit-1);
			message_length = document.getElementById("Message_temp").value.length + 1;
		}
		if(message_length == 0)
		{
			document.getElementById("Message_note").innerHTML = "";
		}
		else
		{
			document.getElementById("Message_note").innerHTML = "Message Length:"+message_length+"/148";
		}
	}

IE needs to be configured to accept ActiveXObjects in the advanced properties. If the browser is set to not accept it, you'll receive "Access Denied" error.

yes, that is what am trying to find out :) , can anyone help me configure for IE please.

Open IE -> Tools -> Internet Options -> Security Tab -> Custom Level -> Active X and plugins

Set it up as you wish =)

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.