"If at first you don't succeed; call it version 1.0" :-Unknown

Pages

Showing posts with label Html 5. Show all posts
Showing posts with label Html 5. Show all posts

Tuesday, January 28, 2014

Restore data after browser crash

Restore data after browser crash

Its a client requirement and we implemented by using html 5 localstorage feature. Here i'm providing a sample of that.

<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
    <title>Local storage</title>
    <script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.4.4/jquery.min.js"></script>
</head>
<body>
    <div>
        <div>
            <div>
                <label>Name:</label>
            </div>
            <div>
                <input type="text" id="name" />
            </div>
            <div>
                <input type="button" id="btnSave" value="Save" />
            </div>
        </div>
    </div>
    <script type="text/javascript">
        $(document).ready(function () {
            function init() {
                if (localStorage["name"]) {
                    $("#name").val(localStorage["name"]);
                }
            }
            init();
        });
        $('input').change(function () {
            localStorage[$(this).attr("id")] = $(this).val();
        });
        $("#btnSave").click(function() {
            localStorage.clear();
        });
    </script>
</body>
</html>

DEMO




If u had any trouble just ask, Happy to help u :)
Stay Tune...
Have a nice day... 'N happy Coding :)

Sunday, May 20, 2012

css for html links

 In this article I’d like to show you six effective ways to add a touch of style to your HTML links. The techniques presented here are really simple to implement. Let’s see the details.

Using a different color

This is the simplest way to make your links different from the rest of the text:


a.color {
    color: #d34545;
}

Using a different color on hover

This technique adds a little bit of dynamism to your links when a user hovers them with the mouse:


a.hover {
    color: #800;
}
a.hover:hover {
    color: #f00;
}

Using a different background color on hover

Same as above, but this time we change also the background color of the links:


a.hover-bg {
    color: #003b6c;
}

a.hover-bg:hover {
    background: #003bc6;
    color: #fff;
}

Using text decoration

A dynamic effect on hover involving the text-decoration property:


a.decoration {
    text-decoration: none;
}

a.decoration:hover {
    text-decoration: underline;
}

Using borders

Another effect on hover but with the border-bottom property:


a.border {
    text-decoration: none;
    border-bottom: 1px solid;
}

a.border:hover {
    border-bottom: 1px dashed #008;
}

Using generated content

We can add a rounded bullet to our links when a user hovers them:


a.generate {
    text-decoration: none;
}

a.generate:hover:after {
    content: '>';
    margin-left: 4px;
    color: #000;
    font-weight: bold;
    display: inline-block;
    width: 20px;
    height: 20px;
    line-height: 20px;
    text-align: center;
    background: #ccc;
    border: 1px solid #999;
    border-radius: 50%;
    text-shadow: 1px 1px 1px #444;
}


If u had any trouble just ask, Happy to help u :)
Stay Tune...
Have a nice day... 'N happy Coding :)

Sunday, November 6, 2011

javascript validation on Default Button event and passing control to server side

Hi *.*,
Heading of my post feel bit difficult to understand isit? :( .Actually i was confused to decide what should be the header of this post.Any way lets move to topic.
My friend again got trouble using default button.Now problem is he using Client-side validation then how can he perform it!!!.First i was also confused. Later i got it :).On my previous post i show how to get keyboard unicode.that helped me here.
onkeypress event of text box i'm checking whether it ENTER key hit or not !!! Now if so i will do my condition if it pass that i will pass event to server side.

Friday, November 4, 2011

Default button and Default Focus

HI *.*,
Default button property is used to specify which button gets clicked when "ENTER" key is pressed.
and Default Focus  property is used to get focus on that control on page start-up(Just like Gmail login,Focus on Username text box and when enter button is clicked login,if valid :P )

Saturday, October 22, 2011

Javascript to hide Address/Menu Bar and open page in new window

Hi *.*,
When we plan to open a new window make sure no popup blocker will catch u :( .
Here are a few technique to create a new window over different event.
1. Onclick

<asp:HyperLink id="lnkSend" runat="server" text="Send" onclick="window.open('mytest.aspx?abc=123', 'NewWindow', 'location=no,menubar=no,status=no,toolbar=no,titlebar=no');" NavigateUrl="#"/>
2.PageLoad (Client Side)

<html xmlns="http://www.w3.org/1999/xhtml" >
<head id="Head1" runat="server">
    <title>Untitled Page</title>
    <script type="text/javascript" language="javascript">
        function windowOpen() {            testWindow = window.open ("http://www.google.com", "mywindow", "menubar=1,status=1,scrollbars=0,width=500,height=500");        }    </script>
</head>
<body onload="javascript: windowOpen();">
    <form id="form1" runat="server">
    <div>
        <h1>Javascript Window</h1>
    </div>
    </form>
</body>
</html>
3.PageLoad (Server Side)
Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
    If Not Page.IsPostBack Then
         Dim width, height, url, target, status, attributes As String
         width = "width=500"
        height = "height=500"
        target = "_new"
        url = "http://www.Simplyasp.blogspot.com"
        status = "status=0"
        attributes = width & ", " & height & ", " & target & ", " & status         Dim js As String = "<script>window.open('" & url & "','" & target & "', '" & attributes & "');</script>"
        ClientScript.RegisterStartupScript(GetType(Page), "Launch_New_Window", js)    End If
End Sub


 4.Open page in new window (DON'T HIDE  Address/Menu Bar)

<asp:HyperLink ID="Hyperlink1" runat="server" NAME="Hyperlink1" Target="_blank" ></asp:HyperLink>



If u had any trouble just ask, Happy to help u :) 
Stay Tune... 
Have a nice day... 'N happy Coding :)

Mapping url over image

Hi *.*,
I know its basic Still it had its important because of that i'm publishing it again here.


<a href='<%# "AgencyVouchers.aspx?id=ORB" + DataBinder.Eval(Container.DataItem,"booking-ID").ToString()%>'>
<asp:Image ImageUrl="~/MainPages/images/ggggg_05.png" ID="imgprint" runat="server" /></a>



If u had any trouble just ask, Happy to help u :)
 Stay Tune... 
Have a nice day... 'N happy Coding :)

Tuesday, August 9, 2011

Sample Lavalamp menu

Hi *.*,
A Lavalamp effect is simply made by an empty element with a declared background color that follows the mouse position when you move it through the items of a menu. In other words, it consists of a simple cursor that changes its left offset when you change your mouse position moving from an item to another.

DEMO


Monday, July 11, 2011

The :first-letter Pseudo-element

In my last post i shared abt  :first-line Pseudo-element, Today abt :first-letter Pseudo-element.
The "first-letter" pseudo-element is used to add a special style to the first letter of a text:

Sunday, July 10, 2011

The :first-line Pseudo-element

It a CSS Style tip.The "first-line" pseudo-element is used to add a special style to the first line of a text.First line depend on Window Size and Break point Not the next Dot (.).

Thursday, June 30, 2011

Introduction to HTML 5

Hi *.*,
As i already explained abt NAV tag in html 5. Today i'm showing what all new in html 5 and how browser support it got

Friday, June 17, 2011

NAV tag in HTML-5

In this tip, i will show how to use the <nav> tag in HTML5 for web site navigation.The HTML5 is great new version of HTML with great features. I am exploring that in great details for our forthcoming projects. I found a great tag that can be used in all websites for the navigation. <nav> tag defines a area for navigation in whole HTML markup.
The HTML5 specification for nav tag is like following. You can find all the HTML 5 specification here.
The nav element represents a section of a page that links to other pages or to parts within the page: a section with navigation links. Not all groups of links on a page need to be in a nav element only sections that consist of major navigation blocks are appropriate for the nav element. In particular, it is common for footers to have a list of links to various key parts of a site, but the footer element is more appropriate in such cases, and no nav element is necessary for those links.
<nav> tags can be used as navigation area and under it you can put the group of links that will use for navigation of area. For example if you have downloaded the ASP.NET MVC3 tool update with HTML5 then you can see they have defined the navigation area with nav tags like following.
<nav>
    <ul id="menu">
        <li>@Html.ActionLink("Home", "Index", "Home")</li>
        <li>@Html.ActionLink("About", "About", "Home")</li>
    </ul>
</nav>
As you can see in above they putted Home and About link in the navigation. So now its with the nag tag the html mark-up is more readable. Once its loaded in browser it and if you view source it will be populate as groups of link in nav tag like following.
<nav>
               <ul id="menu">
                   <li><a href="/">Home</a></li>
                   <li><a href="/Home/About">About</a></li>
               </ul>
</nav>
So that’s it You can see its very easy to use and now we have very readable and clear markup with HTML5. Happy Programming.


Have a nice day... 'N happy Coding :)