How Trigger Window.onblur?
May 23, 2002
I have a little popup window I'm making. I'd like the window to just destroy itself if the user clicks on the original, calling page.
This is what I tried in the header section of the popup page but the code is not being triggered:
<script type="text/javascript"> <!--
window.
-->
</script>
And by the way I already tried this in the body tag:
And the body tag thing actually DID close the window if the user clicked on the original calling page. BUT the window also closed if the user clicked on a combo box on the popup (because the body lost the focus), and that was not good..
View 1 Replies
ADVERTISEMENT
Jun 25, 2009
Put a link on my page that will open an external site (over which I have no control) in a pop-up window. When the user closes the pop-up, I want my original page to redirect to another page. The difficulty I'm having is that I can't add any code to the page in the pop-up as it's not my site.
View 4 Replies
View Related
Dec 2, 2010
I have an input element (textbox) on a webpage, and capture the onblur event of the input (textbox) control to do validation. My problem is that when the page is closed or the user click on another window the onblur event of my textbox gets called too.
I need the onblur event handler to be called only when the textbox loses focus b/c another element on the SAME webpage gets focus, but not when the user clicks on another window or closes the browser window.
View 10 Replies
View Related
Jul 20, 2005
I want to close a popup-window with the onBlur eventHandler.
function closeIt() {
setTimeout('window.close()',2000); }
<body onBlur="closeIt()">
html
</body>
There is a form on my page, and when a input-field gets focus, body looses focus and the window closes. That's not what I want. I want to close the window, if focus goes to another
window or application, but not when someone tries to fill that form.
View 2 Replies
View Related
Dec 10, 2009
Using Javascript, ASP.net with C# code behind. I am validating a textbox using the onblur event. It is being validated in that it must have an alphanumeric entry before the user tabs off of it to the next box. The validation part works, the part that doesn't work is that I get the validation alert textbox if I close the window. I have a workaround in that I am assigning that textbox a character using windo.onberforeunload but I know that isn't right.
Here is what I have so far...
Code behind on Page_Load...
txtCLBRTNWC.Attributes.Add("onblur", "return reqVLD(this)");
Here is my textbox field...
<asp:TextBox ID="txtCLBRTNWC" runat="server" Width="75" MaxLength="4"
ontextchanged="txtCLBRTNWC_TextChanged" TabIndex="1"
onkeyup="clbwclngCHK(this);" ></asp:TextBox>
And here are the 2 functions being used...
function reqVLD(alphanumericChar){
var chk = /^[a-zA-Z0-9]+$/;
// var boxid = document.getElementById("<%=txtCLBRTNWC.ClientID%>").value;
// var matchArray = boxid.match(chk);
if(document.getElementById("<%=txtCLBRTNWC.ClientID%>").value.match(chk)){
return true;
} else {
document.getElementById("<%=txtCLBRTNWC.ClientID%>").focus();
document.getElementById("<%=txtCLBRTNWC.ClientID%>").value = "";
alert("Please enter a Work Center.");
return false;
}}
function clbwclngCHK(obj_in)//When txtCLBRTNWC entry hits the max of 4 auto focuses to next box. {
if (obj_in.value.length == 4) document.getElementById("<%=txtSTRTDT.ClientID%>").focus();
}
Here is my work around...
window.onbeforeunload = function (){
document.getElementById("<%=txtCLBRTNWC.ClientID%>").value = "1";
}
User has to enter something in box before they can move on. This is checked and validating using an onblur event. Problem is, the onblur event fires if closingexiting the window.
View 9 Replies
View Related
Aug 14, 2006
I have a main page that opens a pop up window when the user clicks a
link. The pop up window is a menu and when the user clicks the item, it
populates a form input element on the 'parent' window.
My question is: this new populated form element is the value that I use
to change a style.
onchange does not watch this form element because of getelementbyid, so
it doesn't trigger the function needed to change the style. onchange
works fine if I just manually input a value into the text box.
Any other way to fire the function off when the user picks their
selection from the pop-up window? I was thinking I could use
window.opener.function()? But how do I pass the form from the parent
window? From the pop up window, I don't use this.form, what do I
use?something like window.opener.form[0] ?
View 2 Replies
View Related
Feb 4, 2010
I have this structure:
Index.html:
<html>
<head>
<script src="jquery-1.3.2.min.js"></script>
[Code].....
This is does not work, how I can send trigger event from iframe to parent window?
View 12 Replies
View Related
May 9, 2009
I want to detect when the window is moved, in order to trigger something. I have managed to get the current X and Y coordinates, but other than checking periodically for changed coordinates, is there a way to do this? I want to be able to trigger the code pretty instantly when the window is moved. Probably not possible without checking every half a second - this would be too cpu intensive right?
View 2 Replies
View Related
Jul 3, 2010
<fieldset class="submit" style="padding-left: 200px;">
<?php if ($site_exist >= 1){
echo "<input type="submit" name="submit" value="Update">";
[code]....
View 1 Replies
View Related
Jul 2, 2009
I am having one td and inside td using one control(it may be any control like textbox,combobox) and am using onblur events for td and aswell as the control inside td. when am moving focus from this td to another td the parent onblur event is firing first and then child control(like textbox, combobox) onblur event is firing. The problem is am validating that entire td (what ever the value user updates) in one method. so in this scenario that validate method is calling when i move the focus onto child control. After entering the value in the child control that child control onblur event is firing and am unable to fire the parent control(td) onblur event.
View 1 Replies
View Related
Jan 4, 2011
Ok so I have a site that I want to automatically close the window when the focus is lost from the page. For example, if the user clicks off the page to something else on there desktop I want the page to close. So far I have managed to do this but the grids on my page and the scroll bars all trigger the close function when clicked on. Is there anyway to make the scroll bars and drop down boxes not trigger the function?
This is the code I have so far.
View 6 Replies
View Related
Jul 23, 2005
I've got a window with a "<body onBlur="window.close()"> tag that keeps closing prematurely. It happens when the user clicks on text inside a table in the same window. Apparently IE decides that the <body> no longer has the focus if the <table> within the <body> has it. Firefox handles the page correctly as does MS 5.
This may be one of those "security features" that came along with Windows XP SP2, but wherever it came from, it's a real pain in the you-know-what.
View 4 Replies
View Related
Dec 2, 2010
I wanna implement a button that shows the context menu. I already implemented[URL].. I am now searching for hours about those 2 terms but have not found an answer yet. Also tried to trigger it myself but had no success yet.
View 1 Replies
View Related
May 10, 2011
I want to run a HIDDEN FUNCTION when I click "OK"...not "CANCEL" in window.onbeforeunload() is it possible?
<script type="text/javascript">
window.onbeforeunload = function()
{
[code]....
View 4 Replies
View Related
Aug 11, 2006
I have two textboxes, each of them is controlled with a function called checknumber. It controlles if they are empty or a valid number and I connected this function to onBlur event of these textboxes. The problem is that when I wrote an invalid number to the first and click the second one, It gives continuously error messages. How can I solve this problem ?
View 6 Replies
View Related
Jul 23, 2005
I'm having trouble with a bit of code that is both validating and updating fields on the fly. Here's something similar to my code:
-----------
<script>
function validate(field) {
var frm = document.theForm;
if (field.value != "") {
frm.field3.value = Number(frm.field1.value) +
Number(frm.field2.value);
} else {
alert("Field is empty.");
}
}
</script>
<body>
<form name="theForm">
Field 1 <input name="field1" type="text" onblur="return
validate(this)">
<br><br>
Field 2 <input name="field2" type="text" onblur="return
validate(this)">
<br><br><br>
Total <input name="field3" type="text">
<br><br>
<input type="button" value="Validate"> <input type="button"
value="Cancel" onClick="window.location.href='http://www.google.com'">
-----------
So, I need to
1. Have the "Total" field update whenever a user changes a value in field 1 or field 2.
2. Perform some validation on those fields
3. Have the onblur and validation NOT fire when the user clicks the Cancel button.
Problem: click in the first field, don't enter a value, then try to press Cancel - the validation is happening, and I don't want it to.
This third point above seems to be the kicker. Anyone know a way I can go from a text field to clicking the "Cancel" button without firing the onBlur event? I normally don't like doing validating on-the-fly like this, but my application has the requirement of updating that Total box dynamically, so I have to perform field-level validation as I go....
View 2 Replies
View Related
Jul 23, 2005
I cannot seem to get these two events to work together. If I change
them to say onmousedown and onmouseup, they seem to work fine. In this
case, the onclick appears to work properly but onblur does not kick
in.
<a href="javascript:submitCheck();"><img border="0" alt="Next"
name="btnNext" src="Resources/SurveyButtons/Next.gif"
onclick="this.src='Resources/SurveyButtons/Wait.gif'"
onblur="this.src='Resources/SurveyButtons/Next.gif'"></a>
Any ideas? am i doing something wrong?
View 5 Replies
View Related
Jul 23, 2005
For those who have been using Outlook Express, you must be pretty used to
the fact that whenever you focus on the preview section, the header for the
preview turns from grey to blue, while the text turns from black to white.
Code:
View 3 Replies
View Related
Feb 16, 2006
I have few textfields and dropdowns in my jsp, form is submitted on
clicking an image link.
In case there is an error for instance some text field is left empty,
then message is displayed below respective fields ( using spans, inner
html). The message is displayed onblur event of the field. So if there
was an error then message is displayed, now if the user corrects the
error and clicks the link then first the message disaapears ,which is
desired ,but he has to click again to submit the form. please suggest a
way to handle this. So that user doesn't have to click the link twice
to submit the form.I tried having onmousedown and onfocus events on
image , but then sometimes the form was submitted twice which gave
backend errors.
View 2 Replies
View Related
Mar 3, 2010
I am trying to use onBlur to get to pictures to pop up when a user leaves a text box. The only requirement is that a user must enter any value into the text box if they want the pictures to pop up. Unfortunately, I cannot figure out why my code will not work
Code:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
[code]....
View 3 Replies
View Related
Feb 2, 2008
Supose I have a couple inputboxes, and all have onBlur ---> purpose to evaluate min lenght of text, ... before exiting
input box.
They are all contained inside iFRAME. The onBlur event triggers allso outside iframe, on close browser window, etc
which is unwanted.
1.How to limit onBlur event triggering to objects inside certain IFRAME
2. or..
<input type='text' id='nick' onblur = func(this) ...
function func(obj)
{
// pseudocode - can this be done somehow?
alert(document.getElementById('the next obj that just recived focus'));
}
View 2 Replies
View Related
Jan 5, 2006
I am currently working on a website that administers timed online tests, and we are trying to implement some measures to reduce the ability to 'cheat' while the test is running. These include disabling right clicks, and handling keystroke events. Additionally, we would like to end the test if the maximized browser popup window where the test is loaded happens to lose focus during the testing session.
I have implemented some code to call an event handler that will end the test if a window.onblur event is triggered during the session. It is working fine in Firefox, but IE seems to interpret window.onblur events differently. Basically, in Firefox I can click anywhere within the window without a window.onblur event triggering, but in IE if I click outside of the test table or form element etc. into whitespace, for instance, it fires.
In addition to using window.onblur, I have also tried top.onblur, and also putting onblur in the body tag of my html:
<body bgcolor="#ffffff" onBlur="lostfocus()">
Again, both work in Firefox, but neither of these alternate methods seem to restrict IE in the appropriate manner.
So my question is this: is there any way to craft this such that IE will play nice and trigger the event ONLY when someone clicks outside of the browser window (on to the start menu, for instance)?
<script language="javascript">
<!--
window.onblur=lostfocus;
function lostfocus(e) {
// student has attempted to cheat, end test
}
// -->
</script>
View 10 Replies
View Related
Sep 25, 2006
I have an JS function called from one of my JSP on Blur on a text box. But the JS function is not being called. I am pasting the code below.
<td width="14%">Date of Losses: </td>
<td width="14%">
<input type="text" maxlength = 2 size=2 name="txtLossdd" value="<%=strLossdd%>" checkDay(this)">-
<input type="text" maxlength = 2 size=2 name="txtLossmm" value="<%=strLossmm%>" checkMonth(this)">-
<input type="text" maxlength = 4 size=4 name="txtLossyyyy" value="<%=strLossyyyy%>" checkLossDate()">
</TD>
The JS function
function checkLossDate()
{
alert("Test");
var lossDD=document.frmSicsClmHdrSetup.txtLossddFrom.value;
The first three lines of the function.The first alert not being called. I have used the same logic in one of my other JSP's.There it worked fine. I know i am missing some silly things.
View 1 Replies
View Related
Feb 21, 2009
The onblur event for <div> or <table> is not working while it is working for <input checkbox, text> fields
<div id="abc"
onblur="onblur();">
<table style="border-top: none;color: black; border="0" cellpadding="0" cellspacing="0" onblur="onblur();">
[Code].....
View 6 Replies
View Related
Jul 23, 2005
I'm having some trouble with the "onBlur" event in the BODY tag.
Ideally, what I want to happen is that when someone leaves window A,
window A executes a command. I had put
<body onBlur="savePage();">
I have a couple of problems. On IE 6 (win2000), whenever I put the
cursor focus on a textfield within window A, the "savePage" function
is invoked. And on Mozilla Filefox 0.9.1, the event never launches
even when I leave the window.
Does anyone know how I can solve these respective problems?
View 2 Replies
View Related
Jan 21, 2006
What is the replacement for onBlur in Mozilla
<body STYLE='background-color:buttonface;' leftmargin=0 rightmargin=0
topmargin=0 bottommargin=0 onBlur="window.focus()">
View 1 Replies
View Related