Kết quả 1 đến 1 của 1
-
21-11-12, 01:14 PM #1
- Ngày tham gia
- Jan 2011
- Bài viết
- 1,385
- Thanks
- 168
- Thanked 995 Times in 298 Posts
[Hỗ Trợ] Tại Sao Click Mouse chỉ hỗ trợ IE!
hello ,gz xin chúc các bạn 1 ngày vui vẻ bạn nào có thể cho mình hỏi tại sao js của mình nó chỉ hỗ trợ click ở mouse ở trình duyệt ie vậy mình có 2 file sau xin các bạn sửa cho mình từ ie có thể sử dụng đc các trình duyệt web:*:*:*:*:*:*
-- main.js
Code:function DivShowHide(DivShow,DivHide){ if(DivHide){ document.getElementById(DivHide).style.display='none'; }; if(DivShow){ var _dir = DivShow.indexOf('_'); if(_dir>0){ _tmp = DivShow.split('_'); _parent = _tmp[0]; document.getElementById(_parent).style.display=''; //window.location="#"+_parent; } else { //window.location="#"+DivShow; }; document.getElementById(DivShow).style.display=''; } }; function CreateXmlHttpRequest() { var XmlHttp = null; try { XmlHttp=new ActiveXObject('Msxml2.XMLHTTP') } catch(e) { try { XmlHttp=new ActiveXObject('Microsoft.XMLHTTP') } catch(oc){ XmlHttp = null; } }; if (!XmlHttp && XMLHttpRequest != undefined) { XmlHttp=new XMLHttpRequest() } return XmlHttp; }; function start_loading(_msg){ document.getElementById('START_LOADING').style.bottom = '200px'; document.getElementById('MSG_LOADING').innerHTML = '<b>'+_msg+'</b>'; document.getElementById('START_LOADING').style.display=''; }; function end_loading(){ document.getElementById('START_LOADING').style.display='none'; }; function start_ajax(DivShow,URL,Params,HttpMethod,Messeager){ var _div = DivShow; var _url = URL; var _parms = Params; var _method = HttpMethod; var _msg = Messeager; var _ajax = CreateXmlHttpRequest(); var randNoCache=Math.random(); _url += '&nocache=' + randNoCache; if (_method != "POST") { _method = "GET"; }; if (! _parms){ _parms = null; }; _ajax.onreadystatechange = function (){ if (_ajax.readyState==1 || _ajax.readyState==2){ if(_msg){ start_loading('<img src="http://www.vn-zoom.com/_.musaigon.us/imgs/load.gif" border="0"><br /><font color="#FF0000">Ðang x? lý:</font> '+_msg) } else { document.getElementById(_div).innerHTML = '<img src="http://www.vn-zoom.com/_.musaigon.us/imgs/load.gif" border="0">'; }; }; if(_ajax.readyState == 4) { if(_ajax.status == 200){ var txtResponse = _ajax.responseText; if(txtResponse.substr(0,10) == 'ReloadAll:') { //check Redirect window.location=txtResponse.substr(10); } else if(txtResponse.substr(0,9) == 'Redirect:') { //check Redirect var _tA = txtResponse.substr(9).split("|"); doRedirect(_tA[0].replace(/%20/g,''), _tA[1], _tA[2], _tA[3], _tA[4], _tA[5], 0); } else { document.getElementById(_div).innerHTML = txtResponse; } _ajax = null; end_loading(); } else { if(_ajax.status >= 500){ start_loading('<font color="#FF0000">Phát sinh l?i phía Máy Ch?.<HR/>Mã l?i: ['+_ajax.status+']<BR/>Ð?a ch?: ['+_url.replace('.php@load=',' :: ').split('&')[0]+']<HR/>Xin vui lòng liên h? [email protected] và g?i theo thông báo l?i trên d? du?c gi?i dáp!</font>'); //window.location="#START_LOADING"; } else if(_ajax.status >= 400){ start_loading('<font color="#FF0000">H? th?ng không x? lý du?c yêu c?u c?a b?n t?i th?i di?m này.<HR/>Mã l?i: ['+_ajax.status+']<BR/>Ð?a ch?: ['+_url.replace('.php@load=',' :: ').split('&')[0]+']<HR/>Xin vui lòng liên h? [email protected] và g?i theo thông báo l?i trên d? du?c gi?i dáp!</font>'); //window.location="#START_LOADING"; }; }; }; }; _ajax.open(_method,_url, true); if (_method == 'POST'){ // If sending through POST method, set the headers _ajax.setRequestHeader("Method", "POST " + _url + " HTTP/1.1"); _ajax.setRequestHeader("Content-Type", "application/x-www-form-urlencoded; charset=UTF-8"); } else { _ajax.setRequestHeader("Content-Type","text/html; charset=UTF-8"); } _ajax.send(_parms); return false; }; //Option: ModuleName,Params,HttpMethod,Messeager function send_request(DivShow,DivHide,ModuleName,Params,HttpMethod,Messeager){ var _show = DivShow; var _hide = DivHide; var _url = ModuleName; var _parms = Params; var _method = HttpMethod; var _msg = Messeager; _url = ("Ajax_Module.php" +((_url)? "@load=" +_url : "")); if(!_parms){ _parms = ''; } _method = _method.toUpperCase(); if (_method != "POST") { _method = "GET"; _url = (_url.indexOf('?') == -1)? _url+ "?" +_parms : _url+ "&" +_parms; _parms = null; } if(_msg){ start_ajax(_show,_url,_parms,_method,_msg); //Neu _parms!=null -> POST } else { start_ajax(_show,_url,_parms,_method); } if(_hide){ DivShowHide(_show,_hide); } else{ DivShowHide(_show); }; changeMainTag('MainTag',0,0,0); }; function GETData(DivShow, DivHide, ModuleName, Params, Messeager){ var _show = DivShow; var _hide = DivHide; var _url = ModuleName; var _parms = Params; var _msg = Messeager; send_request(_show,_hide,_url,_parms,"GET",_msg); } function POSTData(DivShow, DivHide, ModuleName, FormName, Messeager){ var _show = DivShow; var _hide = DivHide; var _url = ModuleName; var _objForm = eval('document.'+FormName); var _msg = Messeager; var _parms = ""; for(var i=0;i<_objForm.length;i++) { if ((_objForm.elements[i].type == "checkbox") || (_objForm.elements[i].type == "radio")) { if (_objForm.elements[i].checked) { _parms += "&" + _objForm.elements[i].name + "=" + _objForm.elements[i].value; } else { _parms += "&" + _objForm.elements[i].name + "="; } } else { _parms += "&" + _objForm.elements[i].name + "=" + _objForm.elements[i].value; } }; _parms = _parms.substring(1); send_request(_show,_hide,_url,_parms,"POST",_msg); } function div_show(divname){ var _div = divname; status = document.getElementById(_div).style.display; if (status == 'none'){ document.getElementById(_div).style.display=''; } else { document.getElementById(_div).style.display='none'; }; }; //Gets an element by its ID function getElem(s){ return (document.getElementById)?document.getElementById(s):document.all[s]; }; var MainTagTemp='<table width="100%" border="0" cellspacing="0" cellpadding="0">'+ '</table>'; function changeMainTag(tagId, pos0, pos1, pos2) { var tHtml = MainTagTemp; if (pos0 == 1) { tHtml = tHtml.replace(/tag0/,'class="tagOn"'); } else { tHtml = tHtml.replace(/tag0/,'class="tagOff"'); }; document.getElementById(tagId).innerHTML = tHtml; } function cfdel(DivShow, DivHide, ModuleName, Params, Messeager) { if (confirm("<?=$L_CONFIRM_DELETE?>")) { var _show = DivShow; var _hide = DivHide; var _url = ModuleName; var _parms = Params; var _msg = Messeager; GETData(_show,_hide,_url,_parms,_msg); } return false; } function cf(sCF, DivShow, DivHide, ModuleName, Params, Messeager) { if (confirm(sCF)) { var _show = DivShow; var _hide = DivHide; var _url = ModuleName; var _parms = Params; var _msg = Messeager; GETData(_show,_hide,_url,_parms,_msg); } return false; } function goUrl(sUrl) { window.location='../dulieudangduoccapnhattaisvshost.servecounterstrike.com/w/'+sUrl; return false; } window.onload = function onInit() { GETData('LOGINACCINFO',null,'Login','',''); if ("<?=$actPage?>" == "Home") { changeMainTag('MainTag',1,0,0); } else if ("<?=$actPage?>" == "Register") { changeMainTag('MainTag',0,1,0); } else if ("<?=$actPage?>" == "Download") { changeMainTag('MainTag',0,0,1); } else { changeMainTag('MainTag',0,0,0); } } var cUrl = document.location.href; if (cUrl.indexOf("#") > -1) { var subAr = cUrl.split("#"); if (subAr[0].indexOf(subAr[1]) == -1) { if (cUrl.indexOf('?') == -1) { cUrl = subAr[0] + "@actPage=" + subAr[1]; } else { cUrl = cUrl.substr(0,cUrl.indexOf("?")) + "@actPage=" + subAr[1]; }; } document.location.href = cUrl; }; var topColor, subColor, ContentInfo; ContentInfo = ""; topColor = "#990000" subColor = "#FFFFFF" var mouse_X; var mouse_Y; var tip_active = 1; function update_tip_pos(){ document.getElementById('ToolTip').style.left = mouse_X; document.getElementById('ToolTip').style.top = mouse_Y; } var ie = document.all?true:false; if (!ie) document.captureEvents(Event.MOUSEMOVE) document.onmousemove = getMouseXY; function getMouseXY(e) { if (ie) { // grab the x-y pos.s if browser is IE mouse_X = event.clientX + document.body.scrollLeft; mouse_Y = event.clientY + document.body.scrollTop; } else { // grab the x-y pos.s if browser is NS mouse_X = e.pageX; mouse_Y = e.pageY; } if (mouse_X < 0){mouse_X = 0;} if (mouse_Y < 0){mouse_Y = 0;} if(tip_active){update_tip_pos();} } function EnterContent(TTitle, TContent){ ContentInfo = '<table border="0" width="230" cellspacing="0" cellpadding="0">'+ '<tr><td width="100%" bgcolor="#000000">'+ '<table border="0" width="100%" cellspacing="1" cellpadding="0">'; if (TTitle) { ContentInfo +='<tr><td width="100%" bgcolor='+topColor+'>'+ '<table border="0" width="90%" cellspacing="0" cellpadding="0" align="center">'+ '<tr><td width="100%" align="center">'+ '<font class="tooltiptitle"> '+TTitle+'</font>'+ '</td></tr>'+ '</table>'+ '</td></tr>'; } ContentInfo +='<tr><td width="100%" bgcolor='+subColor+'>'+ '<table border="0" width="90%" cellpadding="0" cellspacing="1" align="center">'+ '<tr><td width="100%">'+ '<font class="tooltipcontent">'+TContent+'</font>'+ '</td></tr>'+ '</table>'+ '</td></tr>'+ '</table>'+ '</td></tr>'+ '</table>'; } function tip_it(which, TTitle, TContent){ if(which){ update_tip_pos(); tip_active = 1; document.getElementById('ToolTip').style.visibility = "visible"; EnterContent(TTitle, TContent); document.getElementById('ToolTip').innerHTML = ContentInfo; }else{ tip_active = 0; document.getElementById('ToolTip').style.visibility = "hidden"; } } function doRedirect(DivShow, DivHide, ModuleName, Params, Notice, Messeager, incSec) { var _show = DivShow; var _hide = DivHide; var _url = ModuleName; var _parms = Params; var _note = Notice; var _msg = Messeager; var _i = incSec; if (_i == 0) { window.location.href="#Top"; document.getElementById(_show).innerHTML = '<br><br><center><b>'+_note+'<b><br>Xin hãy ch? <span id="waitSec">5</span> giây!</center><br><br>'; if ((_hide=='null') || (_hide=='') || (! _hide)) { setTimeout("doRedirect('"+_show+"',null,'"+_url+"','"+_parms+"','"+_note+"','"+_msg+"',1)", 1000); } else { setTimeout("doRedirect('"+_show+"','"+_hide+"','"+_url+"','"+_parms+"','"+_note+"','"+_msg+"',1)", 1000); } } else if (_i <= 5) { document.getElementById('waitSec').innerHTML = (5 - _i); if ((_hide=='null') || (_hide=='') || (! _hide)) { setTimeout("doRedirect('"+_show+"',null,'"+_url+"','"+_parms+"','"+_note+"','"+_msg+"',"+(_i+1)+")", 1000); } else { setTimeout("doRedirect('"+_show+"','"+_hide+"','"+_url+"','"+_parms+"','"+_note+"','"+_msg+"',"+(_i+1)+")", 1000); } } else { GETData(_show,_hide,_url,_parms,_msg); } } function PriSpage(page) { GETData('INDEX_BODY','RIGHTADV','PrivateShop','curPage='+page,''); } function PriSbuy(itemserial) { GETData('INDEX_BODY','RIGHTADV','BuyPrivateShopItem','Serial='+itemserial,''); } function PubSpage(page) { GETData('INDEX_BODY','RIGHTADV','PublicShop','curPage='+page,''); } function PubSbuy(itemserial) { GETData('INDEX_BODY','RIGHTADV','BuyPublicShopItem','Serial='+itemserial,''); } function isEmail(email) { eregEmail=/^[a-zA-Z0-9]+[_a-zA-Z0-9-]*(\.[_a-z0-9-]+)*@[a-z?G0-9]+(-[a-z?G0-9]+)*(\.[a-z?G0-9-]+)*(\.[a-z]{2,4})$/; return eregEmail.test(email); } function isBaseString(tStr) { eregBaseString=/^[a-zA-Z0-9]+[_a-zA-Z0-9-]*$/; return eregBaseString.test(tStr); } function isBaseStringSpace(tStr) { eregBaseString=/^[a-zA-Z0-9]+[_a-zA-Z0-9-\s]*$/; return eregBaseString.test(tStr); } function isNumberString(tStr) { eregBaseString=/^[0-9]*$/; return eregBaseString.test(tStr); } function dofRegister() { var _f = document.getElementById('fRegister'); if (_f.account.value.length<4) { alert('Tên tài kho?n ph?i dài dài t?i thi?u 4 ký t?!'); _f.account.focus(); return false; } if (! isBaseString(_f.account.value)) { alert('Tên tài kho?n ch? bao g?m các ký t? a-z A-Z 0-9 _-!'); _f.account.focus(); return false; } if (_f.password.value.length<5) { alert('M?t mã ph?i dài dài t?i thi?u 5 ký t?!'); _f.password.focus(); return false; } if (! isBaseString(_f.password.value)) { alert('Tên tài kho?n ch? bao g?m các ký t? a-z A-Z 0-9 _-!'); _f.password.focus(); return false; } if (_f.password.value != _f.repassword.value) { alert('Xác nh?n m?t mã sai!'); _f.repassword.focus(); return false; } if (_f.id12so.value.length<5) { alert('12 s? ID ph?i dài dài t?i thi?u 5 ký t?!'); _f.id12so.focus(); return false; } if (! isNumberString(_f.id12so.value)) { alert('12 s? ID ch? bao g?m các con s?!'); _f.id12so.focus(); return false; } if (_f.fullname.value.length<3) { alert('H? và tên ph?i dài dài t?i thi?u 3 ký t?!'); _f.fullname.focus(); return false; } if (! isBaseStringSpace(_f.fullname.value)) { alert('H? và tên ch? bao g?m các ký t? a-z A-Z 0-9 _- và kho?ng tr?ng!'); _f.fullname.focus(); return false; } if (! isEmail(_f.email.value)) { alert('Ð?nh d?ng Email không h?p l?!'); _f.email.focus(); return false; } if (_f.answer.value.length<3) { alert('Câu tr? l?i ph?i dài dài t?i thi?u 3 ký t?!'); _f.answer.focus(); return false; } if (! isBaseStringSpace(_f.answer.value)) { alert('Câu tr? l?i ch? bao g?m các ký t? a-z A-Z 0-9 _- và kho?ng tr?ng!'); _f.answer.focus(); return false; } if (_f.securcode.value.length<3) { alert('Hãy nh?p l?i mã b?o m?t!'); _f.securcode.focus(); return false; } POSTData('INDEX_BODY',null,'Register','fRegister','Ðang ký tài kho?n m?i'); return true; } //kiem tra Submit khi nhan nut goi di cua page doi pass 1 function SubmitRegisterEventDuaTho(){ var ObjectRegister = document.getElementById("CharName").value; if(ObjectRegister==""){ document.getElementById("ThongBao_ObjectRegister").innerHTML = "Nhân v?t không h?p l?.\n"; return false; } else { document.getElementById("ThongBao_ObjectRegister").innerHTML = "<img src='images/check.gif' />"; //document.getElementById("alert6").innerHTML = "<img src='images/tick.png' />S? di?n tho?i h?p l?.\n"; //btn.disabled=false; alert("Nhân v?t b?n ch?n là : "+ObjectRegister); if(ObjectRegister){ POSTData('INDEX_BODY',null,'RegisterEvent','fRegisterEvent',''); } return true; } return false; }
------tooltip.js
Code:// BEGIN TOOLTIP HERE var offsetxpoint=-60 //Customize x offset of tooltip var offsetypoint=20 //Customize y offset of tooltip var ie=document.all var ns6=document.getElementById && !document.all var enabletip=false if (ie||ns6) var tipobj=document.all? document.all["dhtmltooltip"] : document.getElementById? document.getElementById("dhtmltooltip") : "" function ietruebody(){ return (document.compatMode && document.compatMode!="BackCompat")? document.documentElement : document.body } function ddrivetip(title, lead, bgcolor, thewidth){ if (ns6||ie){ if (typeof thewidth!="undefined") tipobj.style.width=thewidth+"px" if (typeof thecolor!="undefined" && thecolor!="") tipobj.style.backgroundColor=bgcolor var output = '<table width="100%" border="0" cellpadding="4" cellspacing="0">\n' output += ' <tr><td class="normalfont" colspan="2"><font color="#000000"><strong>'+title+'</strong></font></td></tr>' output += ' <tr><td class="normalfont" valign="top"><font color="#000000">'+lead+'</font></td></tr>' output += '</table>' tipobj.innerHTML=output enabletip=true return false } } function positiontip(e){ if (enabletip){ var curX=(ns6)?e.pageX : event.clientX+ietruebody().scrollLeft; var curY=(ns6)?e.pageY : event.clientY+ietruebody().scrollTop; //Find out how close the mouse is to the corner of the window var rightedge=ie&&!window.opera? ietruebody().clientWidth-event.clientX-offsetxpoint : window.innerWidth-e.clientX-offsetxpoint-20 var bottomedge=ie&&!window.opera? ietruebody().clientHeight-event.clientY-offsetypoint : window.innerHeight-e.clientY-offsetypoint-20 var leftedge=(offsetxpoint<0)? offsetxpoint*(-1) : -1000 //if the horizontal distance isn't enough to accomodate the width of the context menu if (rightedge<tipobj.offsetWidth) //move the horizontal position of the menu to the left by it's width tipobj.style.left=ie? ietruebody().scrollLeft+event.clientX-tipobj.offsetWidth+"px" : window.pageXOffset+e.clientX-tipobj.offsetWidth+"px" else if (curX<leftedge) tipobj.style.left="5px" else //position the horizontal position of the menu where the mouse is positioned tipobj.style.left=curX+offsetxpoint+"px" //same concept with the vertical position if (bottomedge<tipobj.offsetHeight) tipobj.style.top=ie? ietruebody().scrollTop+event.clientY-tipobj.offsetHeight-offsetypoint+"px" : window.pageYOffset+e.clientY-tipobj.offsetHeight-offsetypoint+"px" else tipobj.style.top=curY+offsetypoint+"px" tipobj.style.visibility="visible" } } function hideddrivetip(){ if (ns6||ie){ enabletip=false tipobj.style.visibility="hidden" tipobj.style.left="-1000px" tipobj.style.backgroundColor='' tipobj.style.width='' } } document.onmousemove=positiontip // END TOOLTIP HERE var baseopacity=30 function slowhigh(which2){ imgobj=which2 browserdetect=which2.filters? "ie" : typeof which2.style.MozOpacity=="string"? "mozilla" : "" instantset(baseopacity) highlighting=setInterval("gradualfade(imgobj)",50) } function slowlow(which2){ cleartimer() instantset(baseopacity) } function instantset(degree){ if (browserdetect=="mozilla") imgobj.style.MozOpacity=degree/100 else if (browserdetect=="ie") imgobj.filters.alpha.opacity=degree } function cleartimer(){ if (window.highlighting) clearInterval(highlighting) } function gradualfade(cur2){ if (browserdetect=="mozilla" && cur2.style.MozOpacity<1) cur2.style.MozOpacity=Math.min(parseFloat(cur2.style.MozOpacity)+0.1, 0.99) else if (browserdetect=="ie" && cur2.filters.alpha.opacity<100) cur2.filters.alpha.opacity+=10 else if (window.highlighting) clearInterval(highlighting) } function hienra(field) { if (field.style.display=='none'){ field.style.display=""; } else{ field.style.display="none"; } } function antoi(field) { if (field.style.display=='none'){ field.style.display=""; } else{ field.style.display="none"; } }
xin chân thành cám ơn.
Các Chủ đề tương tự
-
[MU] Lỗi khi click vào nhân vật bản 11.00.00
Bởi detucuadavid trong diễn đàn Hỏi Đáp/ Yêu CầuTrả lời: 0Bài viết cuối: 26-02-12, 07:08 PM -
[KT] Cần giúp về vấn lỗi không click vào NPC thủ khố
Bởi kakakura trong diễn đàn Hỏi Đáp/ Yêu CầuTrả lời: 7Bài viết cuối: 09-02-12, 01:00 PM -
Click vào NPC
Bởi hihahihuc trong diễn đàn Hỏi Đáp/ Yêu CầuTrả lời: 3Bài viết cuối: 15-08-10, 09:19 AM