Monday, April 4, 2011

What is $ dollar sign In JQuery?

$() is a library function in JQuery, jQuery() is equal to $()

Browsers Benchmarks: JavaScript, CSS3, And HTML5

http://www.tomshardware.com/reviews/firefox-4-internet-explorer-9-chrome-10,2909-14.html



Sputnik

Internet Explorer 9 tops the Sputnik JavaScript conformance test with a score of 5175. Following closely in second place is Opera with a score of 5166. Chrome earns third, achieving 5110 points. Safari places fourth at 5076 points, while Firefox 4 finishes last with 5065.
Acid3

As usual, Google Chrome, Opera, and Apple Safari all pass the Acid3 test with the maximum score of 100. Mozilla Firefox 4 raises the browser's score from 94 to 97, and IE9 still scores a 95.
CSS3 Selectors Test

Once again, every browser except Chrome earns the maximum score of 574 in the CSS3 Selectors Test; Google's browser scores 558.
HTML5Test.com

Chrome again steals the show in HTML5 compliance, earning a score of 288 and 13 bonus points. With version 4, Firefox manages to climb from fourth place up to second, leap-frogging third-place finisher Opera, and sending Safari into fourth. Despite how well IE9 implements HTML5 hardware acceleration, it still finishes last in compliance of the upcoming standard.

Sunday, April 3, 2011

The simplest way to display PDF file in a web page, HTML object Tag

<object data="http://www.pdftest.test/test.pdf" height="360" type="application/pdf" width="600"></object>



Reference: http://www.w3.org/TR/html401/struct/objects.html
13.1 Introduction to objects, images, and applets

HTML's multimedia features allow authors to include images, applets (programs that are automatically downloaded and run on the user's machine), video clips, and other HTML documents in their pages.

For example, to include a PNG image in a document, authors may write:

<BODY>
<P>Here's a closeup of the Grand Canyon:
<OBJECT data="canyon.png" type="image/png">
This is a <EM>closeup</EM> of the Grand Canyon.
</OBJECT>
</BODY>

How to: Serialize and Deserialize JSON Data

http://msdn.microsoft.com/en-ca/library/bb412179.aspx

http://www.4guysfromrolla.com/articles/022311-1.aspx

Call ASP.NET Handler (ASHX) by JavaScript

Call ASP.NET Handler (ASHX) using JavaScript


<%@ WebHandler Language="C#" Class="SayHello" %>
using System;
using System.Web;

public class SayHello : IHttpHandler {
   
    public void ProcessRequest (HttpContext context) {
        context.Response.ContentType = "text/plain";
        string param = context.Request.Params["Name"];
        context.Response.Write("Hello, " + param);
    }

    public bool IsReusable {
        get {
            return false;
        }
    }

}
JavaScript Code
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
<title>Call ASHX in JavaScript by DevCurry.com</title>
<script type="text/javascript">
    var httpReq = null;
    function callASHX() {
        httpReq = XMLHttpRequest();
        httpReq.onreadystatechange = XMLHttpRequestCompleted;
        httpReq.open("GET", "SayHello.ashx?Name=" +
            document.getElementById('<%=txtName.ClientID%>').value, true);
        httpReq.send(null);
    }

    // initialize XMLHttpRequest object
    function XMLHttpRequest() {
        var xmlHttp;
        try {
            // Opera 8.0+, Firefox, Safari
            xmlHttp = new XMLHttpRequest();
        }
        catch (e) {
            // IEBrowsers
            try {
                xmlHttp = new ActiveXObject("Msxml2.XMLHTTP");
            }
            catch (e) {
                try {
                    xmlHttp = new ActiveXObject("Microsoft.XMLHTTP");
                }
                catch (e) {
                    return false;
                }
            }
        }
        return xmlHttp;
    }

    function XMLHttpRequestCompleted()
    {
        if (httpReq.readyState == 4)
        {
            try
            {
                alert(httpReq.responseText);
            }
            catch (e)
            {
            }
        }
    }
</script>
</head>
<body>
    <form id="form1" runat="server">
    <div>
        <asp:TextBox ID="txtName" runat="server"></asp:TextBox>
       <asp:Button ID="btnCall" runat="server" Text="Enter Text and Click"
            OnClientClick="callASHX();"/>
    </div>
    </form>
</body>
</html>