• Home
  • Trace mobile number (From India)
  • Entertainment
  • SiteMap
  • Home
  • ASP.NET
  • C#
  • BLOGGING
  • SQL SERVER
  • FACEBOOK
  • Entertainment
Showing posts with label Window Browser Events. Show all posts
Handling onBlur and onFocus in Frames 


<HTML>
<HEAD>
<SCRIPT LANGUAGE="JavaScript">
function gotFocus() {
 document.bgColor="#FFFFFF"
}
function lostFocus() {
 document.bgColor="#FF0000";
}
</SCRIPT>
</HEAD>
<BODY onFocus="gotFocus()" onBlur="lostFocus()">
<H1>Document 1</H1>
</BODY>
</HTML>

IE4+ Event Coordinate Properties 


<HTML>
<HEAD>
<TITLE>X and Y Event Properties (IE4+)</TITLE>
<SCRIPT LANGUAGE="JavaScript">
function checkCoords() {
    var form = document.forms[0]
    form.srcElemTag.value = "<" + event.srcElement.tagName + ">"
    form.clientCoords.value = event.clientX + "," + event.clientY
    form.pageCoords.value = (event.clientX + document.body.scrollLeft) +
        "," + (event.clientY + document.body.scrollTop)
    form.offsetCoords.value = event.offsetX + "," + event.offsetY
    form.screenCoords.value = event.screenX + "," + event.screenY
    form.xyCoords.value = event.x + "," + event.y
    form.parElem.value = "<" + event.srcElement.offsetParent.tagName + ">"
    return false
}
function handleSize() {
    document.forms[0].resizeCoords.value = event.clientX + "," + event.clientY
}
</SCRIPT>
</HEAD>
<BODY onMouseDown="checkCoords()" onResize="handleSize()">
<H1>X and Y Event Properties (IE4+)</H1>
<HR>
<P>Click on the button and in the DIV/image to see the coordinate values for the
 event object.</P>
<FORM NAME="output">
<TABLE>
<TR><TD COLSPAN=2>IE Mouse Event Coordinates:</TD></TR>
<TR><TD ALIGN="right">srcElement:</TD><TD><INPUT TYPE="text" NAME="srcElemTag"
 SIZE=10></TD></TR>
<TR><TD ALIGN="right">clientX, clientY:</TD><TD><INPUT TYPE="text"
 NAME="clientCoords" SIZE=10></TD>
<TD ALIGN="right">...With scrolling:</TD><TD><INPUT TYPE="text"
 NAME="pageCoords" SIZE=10></TD></TR>

<TR><TD ALIGN="right">offsetX, offsetY:</TD><TD><INPUT TYPE="text"
 NAME="offsetCoords" SIZE=10></TD></TR>
<TR><TD ALIGN="right">screenX, screenY:</TD><TD><INPUT TYPE="text"
 NAME="screenCoords" SIZE=10></TD></TR>
<TR><TD ALIGN="right">x, y:</TD><TD><INPUT TYPE="text" NAME="xyCoords"
 SIZE=10></TD>
<TD ALIGN="right">...Relative to:</TD><TD><INPUT TYPE="text" NAME="parElem"
 SIZE=10></TD></TR>
<TR><TD ALIGN="right"><INPUT TYPE="button" VALUE="Click Here"></TD></TR>
<TR><TD COLSPAN=2><HR></TD></TR>
<TR><TD COLSPAN=2>Window Resize Coordinates:</TD></TR>
<TR><TD ALIGN="right">clientX, clientY:</TD><TD><INPUT TYPE="text"
 NAME="resizeCoords" SIZE=10></TD></TR>
</TABLE>
</FORM>
<DIV ID="display" STYLE="position:relative; left:100">
<IMG SRC="nile.gif" WIDTH=320 HEIGHT=240" BORDER=0>
</DIV>
</BODY>
</HTML>

Using the srcElement property 


<HTML>
<HEAD>
<TITLE>srcElement Property</TITLE>

<SCRIPT LANGUAGE="JavaScript">
function highlight() {
    var elem = event.srcElement
    if (elem.className == "bold") {
        document.styleSheets[0].rules[0].style.color = "red"
    } else {
        elem.style.color = "#FFCC00"
    }
}
function restore() {
    var elem = event.srcElement
    if (elem.className == "bold") {
        document.styleSheets[0].rules[0].style.color = "yellow"
    } else {
        elem.style.color = "red"
    }
}
</SCRIPT>
<STYLE TYPE="text/css">
.bold {font-weight:bold}
</STYLE>
</HEAD>
<BODY onMouseDown="highlight()" onMouseUp="restore()">
<H1>srcElement Property</H1>
<HR>
<P>One event handler...</P>
<UL>
<LI>A
<LI>BB
<LI>CCC
<LI>DDDD
</UL>
<P>
Text Text <span class="bold">Text</span> Text Text Text Text
</P>
</BODY>
</HTML>

Event Bubbling Demonstration 


<HTML onClick="alert('Event is now at the HTML element.')">
<HEAD>
<TITLE>Event Bubbles</TITLE>
<SCRIPT LANGUAGE="JavaScript">
function init() {
    window.onclick = winEvent
    document.onclick = docEvent
    document.body.onclick = docBodEvent
}
function winEvent() {
    alert("Event is now at the window object level.")
}
function docEvent() {
    alert("Event is now at the document object level.")
}
function docBodEvent() {
    alert("Event is now at the BODY element.")
}
</SCRIPT>
</HEAD>
<BODY onLoad="init()">
<H1>Event Bubbles</H1>
<HR>
<FORM onClick="alert('Event is now at the FORM element.')">
<INPUT TYPE="button" VALUE="Button 'main1'" NAME="main1"
    onClick="alert('Event started at Button: ' + this.name)">
</FORM>
</BODY>
</HTML>
Older Posts Home

Most Read

  • How to Capitalize the First Letter of All Words in a string in C# ?
  • keyboard shortcuts For Windows
  • List Of Best Free WordPress Plugins : 2012
  • Read Write XML Data-Read Write XML File Using C#, VB.NET In Asp.Net
  • How to Shake Internet Explorer - Javascript Code
  • How to Choose a Nice Topic for your Blog .
  • Free Search Engine Submission List ,search engine optimization
  • Number validation in Textbox of ASP.NET Using Regular Expression validator
  • Javascript:Percentage Gain Javascript Calculator
  • .Net Interview Questions and Answers on OOPS | OOPS Frequently Asked Questions
Google
Custom Search Bloggers - Meet Millions of Bloggers

Join Us On FaceBook

  • Recent Posts
  • Comments

All Topics

  • ▼  2014 (10)
    • ▼  January (10)
      • ASP.NET Interview Question : difference between ge...
      • Dot Net Framework:What is the .NET Framework?
      • Dot NET Framework - .NET Framework Interview Quest...
      • What is the differences between MVC2,MVC3 and MVC4...
      • Is try catch is using a good coding (exception han...
      • What is the use of Just - In - Time (JIT)?
      • What is GUID , why we use it?,how to create a GUID
      • How to Rename database table column in sqlserver
      • How to Rename Database in sqlserver
      • Asp.net Example Calendar Control
  • ►  2013 (14)
    • ►  October (1)
    • ►  April (2)
    • ►  March (11)
  • ►  2012 (142)
    • ►  December (25)
    • ►  October (1)
    • ►  September (9)
    • ►  August (2)
    • ►  July (7)
    • ►  June (2)
    • ►  April (5)
    • ►  March (27)
    • ►  February (27)
    • ►  January (37)
  • ►  2011 (23)
    • ►  December (3)
    • ►  November (6)
    • ►  October (12)
    • ►  September (2)
  • ►  2009 (1)
    • ►  June (1)

Tips & Tricks

  • What is good One Blog and Many Categories, or Many Blogs with One Categories?
  • Adding Twitter tweet button to each Blogger posts.
  • How to Choose a Nice Topic for your Blog .
  • Embedding YouTube Videos ,movie in your blog
  • Facebook iFrame Apps – Getting Rid of Scrollbars
  • Facebook Analytics:How to Set Up Your Website or Blog with Facebook Insights for Domains
  • How To Add Perfect Share Box to Blogger
  • Blogger Free Images Hosting Tip,Free unlimited bandwidth image hosting for Blogger blogs
  • Add “Link to this post” codes below Each blogger posts
  • Free Search Engine Submission List ,search engine optimization
  • Adsense Tips for Maximum CTR
  • List Of Best Free WordPress Plugins : 2012
2012 tectopix. All rights reserved.
Designed by tectopix