แสดงบทความที่มีป้ายกำกับ Javascript แสดงบทความทั้งหมด
แสดงบทความที่มีป้ายกำกับ Javascript แสดงบทความทั้งหมด

วันอังคารที่ 25 พฤษภาคม พ.ศ. 2553

Greasemonkey and JQuery

I try to @require http://ajax.microsoft.com/ajax/jQuery/jquery-1.4.2.js
but it fail

so after search found if use full version (min version will get another error.)
we must change some in jquery code in line by used try catch to avoid error

isSupported = (eventName in el);
if ( !isSupported ) {
el.setAttribute(eventName, "return;");
isSupported = typeof el[eventName] === "function";
}
el = null;

to

try {
isSupported = (eventName in el);
if ( !isSupported ) {
el.setAttribute(eventName, "return;");
isSupported = typeof el[eventName] === "function";
}
el = null;
} catch(e) {}

now it work.

and another notice require will load only once when install user script to grease monkey so if you edit it it will need to uninstall and install again

to install new script is easy drag and drop your script to browser.

and you got lasted script by

http://www.asp.net/ajaxlibrary/cdn.ashx

วันศุกร์ที่ 21 พฤษภาคม พ.ศ. 2553

Reset window Position when post with JavaScript.

Easy way is with javascript

javascript:window.scrollTo(0,0);

but what if your element to reset is not whole window.

try this

gotoContentTop();

and in JavaScript function gotoContentTop() like this

function gotoContentTop()
{
document.getElementById('innerContentHolderArea').scrollTop = 0;
}

For use JQuery

$('#innerContentHolderArea').scrollTop(0);

Hope this help.

วันอังคารที่ 9 กุมภาพันธ์ พ.ศ. 2553

IE8 Javascript Can't Enable

I try anything to setup delete uninstall reinstall any add on and last is IE8 itself.
Nothing work - -'

So i find find and find finally found this

Start > Run...
In the Run box, type in (without quotes) "regsvr32 jscript.dll"
You should receive a popup says that it registration succeeded.

Work now. may be registry have some damage?
so don't make this mistake again.