onfocus

How do I enter text in textfield with onkeyup/onfocus javascript?

萝らか妹 提交于 2019-12-02 13:53:43
问题 We have a web application that I am trying to automate testing for, using Java, Web Driver and TestNG. The biggest challenge I'm facing (failing at) is to stay ahead of development and prevent the test framework from breaking with even minor code changes. Problem There's a text field that accepts numbers. Up till now, sendKeys did the job for me. In a recent change to the page source, when numbers are entered, commas get automatically inserted. So "50000" becomes "50,000" for example. Now

Check for CapsLock ON in “onfocus” event

余生颓废 提交于 2019-12-01 21:42:49
My following code for checking whether Capslock is on or not works fine on "onkeypress" event. But i want it for "onfocus" event. i tried replacing "onkeypress" with "onfocus" for the control,but it doesnt work for me. Any help? (either in javascript or Jquery) <script type="text/javascript" language="Javascript"> function capLock(e) { kc = e.keyCode ? e.keyCode : e.which; sk = e.shiftKey ? e.shiftKey : ((kc == 16) ? true : false); if (((kc >= 65 && kc <= 90) && !sk) || ((kc >= 97 && kc <= 122) && sk)) document.getElementById('divMayus').style.visibility = 'visible'; else document

window.onfocus not firing in IE7, inconsistent in Opera

本小妞迷上赌 提交于 2019-12-01 17:34:36
Note that this relates to focus and blur events on a window, not on form fields. I'm loading a document in a pop-up window, and it includes the following code: <script type="text/javascript"> window.onblur = function(){ document.title="BLURRED"; } window.onfocus= function(){ document.title="FOCUSED"; } </script> These functions are temporary, for testing. I'd hoped to use these events to set a flag indicating the window state; I'm doing a chat app, and if messages come in when it's minimized I'll do some attention-getting title changes. If they don't cancel when the window gets focus, though,

manually trigger focus on input Iphone issue

流过昼夜 提交于 2019-12-01 17:05:16
问题 I am trying to focus a textarea after a click on a another element. desktop browsers seems to be working fine but not the Iphone. $('.reveal_below').on('change', function(e) { e.preventDefault(); var item_id = $(this).attr('data-item-id'); if (this.checked) { $('.hidden_below__' + item_id).css({ 'margin-left': '0px', display: 'block', opacity: '0' }).animate({ 'margin-left': '15px', opacity: '1' }, 250, function() { console.log("-----------"); $("#x").focus(); }) } else { $('.hidden_below__'

focus on second edittext only if first is non-empty android

佐手、 提交于 2019-12-01 07:32:43
Currently I have two edit-text,suppose I want to make validation for empty edittext check.What is better way for runtime validation. My code is; final EditText ev1 = (EditText) findViewById(R.id.editText1); final EditText ev2 = (EditText) findViewById(R.id.editText2); ev1.setOnFocusChangeListener(new OnFocusChangeListener() { @Override public void onFocusChange(View rv, boolean hasFocus) { if(!hasFocus && ev1.getText().length()==0) { ev1.requestFocus(); ev2.clearFocus(); } } }); In this onclick of second editText it clears the focus of second EditText when First Edittext is empty,but keyboard

Java Key Bindings Not Working

倾然丶 夕夏残阳落幕 提交于 2019-12-01 04:15:14
I am trying to make key bindings in Java on a JPanel. I want a certain action to execute when I press the 'w' button. I follow the Java tutorial on making bindings, but the actionPerformed method does not execute (i.e. no text prints out). The following is the entirety of the code for my test GUI, with the relevant part highlighted: import java.awt.BorderLayout; import java.awt.event.ActionEvent; import javax.swing.AbstractAction; import javax.swing.JFrame; import javax.swing.JPanel; import javax.swing.KeyStroke; @SuppressWarnings("serial") public class Test extends JFrame{ private JPanel

CSS: How make the cursor to become a pointer on the input file?

笑着哭i 提交于 2019-12-01 00:03:39
How can I make the cursor to become a pointer on an input file or an input text when you hover it? My try but it does not work of course, <input type="file" style="cursor: pointer;"/> Or do I have to use javascrip (jquery)?? EDIT: Sorry my mistake - the cursor does change to a point on <input type="text" style="cursor: pointer;"/> But not on <input type="file" style="cursor: pointer;"/> You can test this link on Firefox then you see what I mean. Only the button of file change to the pointer but not the input field of file . EDIT 2: Here is my CSS 'hack', <div id="right-col" style="position

react-navigation: Detect when screen, tabbar is activated / appear / focus / blur

血红的双手。 提交于 2019-11-29 01:08:50
Perviously when I wanted to make some actions when screen is opened I put them inside componentDidMount. For example I can fetch some data. like this. componentDidMount() { this.updateData(); } But with react-navigation componentDidMount occurs only one time when user open screen first time, and if later user open this page again it will not trigger componentDidMount. What is proper way to detect when page(screen) is activated and do actions? With react-navigation , you can do that. Add listeners in componentDidMount or componentWillMount this.subs = [ this.props.navigation.addListener(

MFC on screen keyboard when focusing editable control

冷暖自知 提交于 2019-11-28 14:28:40
I want to do a thing conceptually simple as this: For every control that accepts keyboard input(CEdit, CCombobox with Editable text, etc.), when the control is focused and enabled, make the On Screen Keyboard appear. Preferably with accessibility support (I've done some reading about Microsoft User Interface Automation) rather than calling directly the osk.exe utility. A thing very like the touchscreen smartphones when the user puts the focus on an editable control. UPDATE: If there is a Windows option that can make the On Screen Keyboard to behave the way I describe that's just fine! UPDATE 2

How to determine when an HTML5 element has been viewed?

早过忘川 提交于 2019-11-28 11:48:46
I am wondering if there are any HTML5 events associated with whether or not an element has been viewed or "scrolled into view" by the user. An example could be a longer page with elements at the bottom, which has yet to be scrolled into the users view... I have seen jQuery solutions to this problem, however I am only interested in figuring out if weather or not this is achievable purely though the use of HTML5 events and JavaScript. It should be noted that I have already had a look at the "onfocus" event, which (from it's official description) seems to only be applicable if the user selects or