Showing posts with label Javascript. Show all posts
Showing posts with label Javascript. Show all posts

Monday, April 19, 2010

Browser Emulator

I was recently requested by my client to help fix a bug happening in I.E 6. I can't remember when on earth I last used I.E 6 and why this customer is so skeptical about this old nasty browser. But the truth is I have to fix it. My Windows now is a neat 64 Bit Windows 7 which doesn’t even knew there existed a browser called I.E 6.

I was looking for Emulators online and came across this stuff from Microsoft - Microsoft Expression SuperPreview. I downloaded, installed and played with it while I fixed the bug.

It's a good tool with some features of firebug. The difference being this displays the page layout as it is in a particular browser version, and can open two frames of two different browser versions and show the comparison I tried it and seems very helpful.

On the dark side sessions cannot be configured so for checking UI issues of Session enabled pages – I had to save as webpage complete and then open that file.

Some cool Features:

• Multi browsers Firefox xx , IE (6, 7, 8)
• Compare in two browsers simultaneously
• Dom related checks available
• Can set screen resolutions
• Configure more browsers like chrome/Safari etc.

Drawbacks (I didn’t explore, could be wrong)

• No JavaScript Checks
• Session pages cannot be tested live


Read more:

http://expression.microsoft.com/en-us/dd565874.aspx

Tuesday, January 05, 2010

JSON - Jquery

JSON & Jquery might have stormed well in the AJAX/WS world. But the right documents are missing. I was banging myu head for a few hours, on how to get a json object from a codebehind:

I was building a JSON object:{name:myvalue}

Tried all ways and it never workd in the Ajax method:

$.post("test.aspx?tbg=yu", $("#form1").serialize(),
function(data) {
alert(data.name); ---->Always returned undefined. In firebug it was not showing at all.


The Right solution is {name:'myvalue'}. This ******ing >>>>'<<<<< style="font-style: italic;">-Happy Hacking

Sunday, March 22, 2009

EventBubble in Javascript

Today I came across a cool method of Javascript. Basically I was trying to fix a long running bug. The underlying issues was something similar:

<tr id="idTR" class="some-Tr-Class" onclick="javascript:Ajsclass.doTRWork();" >

<td class="some-Td-Class" onclick="_do_nothing()">

<input type="checkbox" id="dynamicallyGen" value="xyz">

<td class="some-Td-Class">

..Some title..

</td>

.....
....

</tr>



My Issue is I want to override the Ajsclass.doTRWork();. for the first TD with the checkbox. Was wondering how to
to fix it. Finally Mozilla helped me with their API documentation.

The solution is to not call the bubble function which is Ajsclass.doTRWork(); Just stop after _do_nothing().

The solution is to add:

event.cancelBubble = true;


in the _do_nothing().

The above works fine for Firefox but not for IE


For IE add the following:

event.stopPropagation()


Cool aha? I started liking javascript right from the beginning of this project as 70% of my work was Ajax & JS.