Changing Focus ? - Please Help
Sep 17, 2006
I am opening a child window with the following href.
If it is a completly new window, it is opened and the focus shifts to it.
if that href has been clicked on before and the window exists, the focus stays with the parent window and does NOT shift to the child.
How can I make the focus shift?
here is my href:
echo "<a href='$Ad_detail' rel="external" onclick="window.open this.href, '$Ad_detail', 'height=800,width=960,scrollbars'); return false" >
I guess I need a "window. ? focus();" in there somewhere - but I don't know what the ? should be.
View 3 Replies
ADVERTISEMENT
Aug 18, 2010
I'm currently making a web application which needs to be fully compatible with iPad. The functions I've implemented so far work perfectly on Firefox, Internet Explorer and other browsers. However, the iPad itself responds a bit different. After a certain action, I want to put focus on a textfield with the help of Javascript. Again, this works perfectly with the normal browser, the iPad browser however seems to be blocking the focus. The reason I'm not posting any code is because it's basically irrelevant. All I do is:
[Code]...
View 1 Replies
View Related
Jul 23, 2005
Is there a reason why setting focus to a textbox input, also gives
focus to a submit button on the page, to where if you click enter in
the text box, the submit button will be clicked.
View 2 Replies
View Related
Mar 29, 2011
The default behaviour of focus() method is displaying the cursor at start of the char(In FF focusOffset is 0(zero) and anchorOffset is 0(zero)). I need to display the focus at end of char after calling focus() method.
View 5 Replies
View Related
May 9, 2010
I think the problem is cause by my lack of understanding of how the browser (firefox 3.6.3) handles focus.A simplified version of my problem is:I've defined the function
function two_focus()
{
document.getElementById("two").blur();
[code]....
View 6 Replies
View Related
Apr 10, 2011
Is there a way to set the focus on a form field without using focus()? I use ajax to build the form and if I try to set the focus using focus() an error is generate because of the form hasn't been built by ajax. So, it would be nice if I could set the focus() as I built the form.
View 4 Replies
View Related
Jan 12, 2011
I currently have a normal link like Code:<a href="http://sitepoint.com" class="link">sitepoint</a> and when a user clicks on it I want to be able to change the "link" class to a different class. However, I don't want to add anything to the actual link html. Is it possible to do this using javascript without modifying the original link code?
View 4 Replies
View Related
Feb 2, 2011
I am trying to dynamically clear the value of a form input field and then submit the form.When I used $('#my_field').val('') to clear the field, it was cleared on the screen but when the form was submitted the original value of the input field was posted.My browser is FireFox and I can see using FireBug that when the field is cleared, firebug is still showing the html code with the old value. E.G. <input type="text" value="old_value" />The same situation occurred if I used $('#my_field').attr('value', '') to clear the field.The same situation occurred if I actually changed the value of the field rather than just clearing it.To work around this problem I ended up using the $('#my_field').removeAttr('value') to clear the field before it was submitted.
View 1 Replies
View Related
May 20, 2007
I'm attaching an onfocus event handler to an anchor tag like this:
if(window.attachEvent) anchor_node.attachEvent('onfocus', gotFocus);
if(window.addEventListener) anchor_node.addEventListener('focus',
gotFocus, false);
function gotFocus() {
alert('i got focus');
}
Is there any way to tell the difference between when this anchor is
focused by a user (perhaps by tabbing to it) as opposed to when I
programatically do it via anchor_node.focus()?
View 4 Replies
View Related
Jan 5, 2011
When a website is loaded, is there anyway of using Javascript to get the address bar focus and delete the contents?
I'm not sure if there would be restrictions on doing this because of security reasons
View 4 Replies
View Related
May 7, 2009
I am a complete novice when it come to Javascript. I copied the script for displaying random images at a specific interval (from javascriptkit.com). I would appreciate knowing whether the following is possible:
The pages are based on tables, so the parts that change are all cells.
1. Can I define text instead of an image in the array? i.e. can I have the image change to say an apple in one cell and the next cell have text explaining what an apple is?
2. Would it be possible to put a countdown timer for when the image/text is going to change?
View 7 Replies
View Related
Jul 6, 2011
Ive got a small image of a power button and when pressed the inner section on the button changes to yellow, but when its pressed down Im also trying to get part of my H1 (main header logo title) to change to yellow.
Ive created a span with an id surrounding the letters of the H1 that I want to change, the id being : "power";
The javascript that I have come up with so far and works is as follows:
<img id="poweron" src="http://www.sitepoint.com/forums/images/power.png" alt="Power on button" onmousedown="this.src='images/poweron.png';" onmouseup="this.src='images/power.png';"/>
I understand Im not really supposed to be using inline JS, and I know Ive got to create a function for the onmousedown event to trigger changing the H1 text, so am I under the right impression that the JS so far written is redundant and will have to be re-written so thats contained within a script placed just before the closing </body> and an external script for invoking the main function ?
View 2 Replies
View Related
Sep 13, 2005
When I validate a form on submission I use the javascript focus function to
scroll the page to the location of the form error e.g.
document.[Form Name].[Field Name].focus();
If you happened to have the page scrolled above where the error field is
then the page will scroll so that the error field is at the very top of the
window. If you happened to have the page scrolled below where the error
field is then the page will scroll so that the error field is at the very
bottom of the window. Neither of these is very desirable. Any way to get the
error field to the middle of the window?
e.g. in javascript after the focus statement, can one test the location of
the error field and then either add half a windows worth of pixels to it if
it is at the top of the screen or subtract half a windows worth of pixels to
it if it is at the bottom of the screen?
View 3 Replies
View Related
Nov 23, 2005
document.TESearch.txtDesc.focus();
Would set the focus to the txtDesc iten of the TESearch Form..OK
Is there a way of asking the document what "item" has get the focus
I need to check were the cursor has been moved to "the new focus"
before an onblur event can deside what action to take.
ie
itemfocus = document.focus?
if itemfocus = txtbox1 then do something else do something else
View 1 Replies
View Related
Dec 1, 2005
If in the textarea (textarea3), the value is not "abc", and the user
uses "Tab" to go to the next textarea (textarea4), it will alert an
error message...and the focus will return to the textarea (textarea3)
again...
It works in Internet Explorer, however in firefox it does not work?
Anyway have any ideas why & how? Code:
View 9 Replies
View Related
Jul 23, 2005
If I use the following construct in the frame "main" for a link to an
extern site:
<A HREF="http://www.any.xy" TARGET="extern">
the Browser is creating the window "extern", loading the page
www.any.xy an setting the focus to "extern". But when I go return to
"main" without closing "extern", a click to an other link (e.g.
www.2nd_any.xy) on "main" does not setting the focus to "extern".
For setting the focus to "extern" in the second case, I have used the
following construct:
<A HREF="http://www.any.xy" TARGET="extern"
onClick="setTimeout('extern=window.open('','extern');fr emd.focus();',500);">
an example</A>
This construct has worked very well for a few years, but since about
one year, the sesult was the same as using
<A HREF="http://www.any.xy" TARGET="extern">
In this year, I have changed:
win 95 --> win 2000
modem 56k --> DSL
Netscape 4.5 --> Netscape 7.1
Can anybody tell me a possibility setting the focus to "extern" in the
second case? Is the changing of my configuration the reason, that the
construct has failed?
View 31 Replies
View Related
Jul 23, 2005
Neglecting the annoyance factor for a moment, is it possible to keep one browser window at the screen forefront (in front of all other browser windows) but still be able to interact with a window directly beneath it? How would this be pulled off in JS?
View 3 Replies
View Related
Jul 23, 2005
I encountered some strange behaviour when using focus()
I use a form with several input-fields. A user can enter stuff. After
entering I want to check the value, i.e. that a number is only a
number etc.
I therefore started editing a Javascript. For test purposes it only
popup a message and sets the focus. In fact this is what I want to do,
but the scipt isn't it doing right.
Here is the script:
View 1 Replies
View Related
Jul 23, 2005
I'm trying to do default focus on checkbox,its work fine but the
problem is that the user cannot know where is the focus (there isn't
visual sign and on the other hand if you press on the tab button there
is a visual sign).
View 1 Replies
View Related
Jul 23, 2005
is there any way I can get what field has focus in the form? I would
like to trap the "backspace" only if focus is on spesific field.
View 3 Replies
View Related
Jul 23, 2005
I have a date validation function that I want to stay at the object I am
validating if there is a Validation error, but it always goes to the next
object.
The javascript:
function ValidateForm(me){
var dt=me
if (isDate(dt.value)==false){
dt.focus()
return false
}
return true
}
The html:
<input name="AbsentFrom1" type="text" size="10" id="AbsentFrom1"
onBlur="return ValidateForm(this)" />
I do get the error box in my other function (isDate) and it is doing the
dt.focus().
Why doesn't it stay there?
View 5 Replies
View Related
Oct 7, 2005
I have a page that has 3 different iframes in it. The bottom iFrame
continually gets updated as the user adds different images to it
through the interface, and once the user clicks one of the images, I
change the style of the image to put a border around it.
The problem is, once I set off this function to put a border around the
clicked image, the iFrame resets itself. So, if I've scrolled over to
the right a bit and clicked on a pic, the frame resets itself all the
way to the left, so the user would have to scroll back over to see the
pic they just clicked.
I've tried doing an onFocus in the function that adds the style, and
it's not working.
identity=document.getElementById(picid);
identity.focus();
Any ideas?
View 1 Replies
View Related
Apr 5, 2006
Ive got a really simple problem but I can't figure it out. I've got a
form named bob with one text box name bobtext with a default value of
"http://". When I add onload="document.bob.bobtext.focus()" it focuses
on the text box, but at the beginning. Is it possible to focus on the
text box, but at the end of "http://"? This seems like something easy
so I'm probably making some stupid mistake.
View 1 Replies
View Related
Apr 19, 2006
this is for a browser window that contains a chat app that is an applet... when browser window is not in focus I would like users to somehow get notified when a message arrives, more or less like regular IM apps do.. I did with window.focus(), but I don't really want window to come into focus, I just want it to 'blink' and then stay highlighted.. I tried window.setActive() method (not sure what that method does but wanted to try it) but I get obj-non-supported error in
IE6 with that method ..
View 3 Replies
View Related
Mar 21, 2007
I have :
<div id="obj">Objet :</div>
I want to put the focus AFTER the text "Objet :", is it possible ?
Note : I don't want to create 2 div tags.
View 7 Replies
View Related
Oct 1, 2007
does some one know whay this code doesn't works with mozilla:
<body onload="window.focus();">
how can i focus this window in both explorer and mozilla browsers?
View 3 Replies
View Related