Wednesday, January 14, 2009

Monday, January 12, 2009

JQuery : Silde


Learning jQuery in 30 minutes

From: simon,
2 years ago





Slides from a half hour jQuery tutorial at BarCamp London 3.



SlideShare Link

Sunday, January 11, 2009

Javascript : From Parent to Child

This case is not very well documented.
I found a nice tutorial here :
http://radio.javaranch.com/pascarello/2005/01/18/1106063002000.html

You can download samples here:
FromChildToParent


<%@ Page Language="vb" AutoEventWireup="false" CodeBehind="Default.aspx.vb" Inherits="WebApplication10._Default" %>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head id="Head1" runat="server">
    <title></title>

    <script type="text/javascript">
        var w;
        function openPopup() {
            w = window.open("popup.aspx");
            setTimeout("SendToChild()", 200);            
            //This works on FF.
            w.onload = function() {
                alert("child loaded");
            }
        }
        function SendToChild() {
            value = window.document.getElementById("tochild").value;
            w.document.getElementById("fromparent").innerHTML = value;
        }
    </script>

</head>
<body>
    <form id="form1" runat="server">
    <div>
        <input id="tochild" type="text" runat="server" />
        <span id="opener" title="???" onclick="openPopup()" onmouseover="this.style.cursor='hand'">
            Send To Child</span>
        <hr />
        Child said : <span id="fromchild"></span>
    </div>
    </form>
</body>
</html>

Javascript : From Child to Parent

Passing data between Popup to Parent window is easy once you are aware of the
method window.opener method

<%@ Page Language="vb" AutoEventWireup="false" CodeBehind="popup.aspx.vb" Inherits="WebApplication10.popup" %>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
    <title></title>

    <script type="text/javascript">
        function alertParent() {
            var divparent = window.opener.document.getElementById("fromchild");
            var chidmsg = document.getElementById("toparent");
            divparent.innerText = chidmsg.value;
            window.close();
        }
    </script>

</head>
<body>
    <form id="form1" runat="server">
    <div>
        <input id="toparent" type="text" />
        <input id="Button1" type="button" value="Respond to Parent" onclick="alertParent();" />
    </div>
    <hr />
    Parent said : <span id="fromparent"></span>
    </form>
</body>
</html>