Detecting Tab Key

Jul 20, 2005

I'm trying to use JS to move the cursor from my user login text field
to the password text field - I've put the onKeyPress() event in the
user input tag but then I press the Tab key the cursor doesn't move -

function detect_tab_key()
{
var key_code = window.event.keyCode;
if (key_code == 9)
{
document.forms[0].frm_password.focus();
document.forms[0].frm_password.select();
}
}

View 1 Replies


ADVERTISEMENT

Detecting Tds Of A Certain Table?

Jun 26, 2009

I would to change the color of some td cells if there is text in it. Right now this code does the job, but it changes the color of evry table. I'd like to know a way to do this on one table in my page and not all of them.

var count='0';
var TDs=document.getElementsByTagName('td')
var length=TDs.length;
i='0';

[Code]....

View 3 Replies View Related

Detecting Which Key Was Pressed

Oct 1, 2007

example: onkeypress="return eventHandlerFunction(event)"

Why is it that you need the return keyword?
Where does the argument event come from?

I know it works, I just want to know why it works.

I've been looking at some refferences and can't seem to find an answer if someone could give me an explanation or point me to a website, that would be great.

View 2 Replies View Related

Detecting Buttons

Oct 5, 2007

I am trying to do something I thought would be simple in javascript, and I'm at a loss. First code is GOOD code, except that it does not account for the possibility that the button(s) in question do NOT exist. The second and third subsets are two of several attempts to do just that. Code:

View 2 Replies View Related

Detecting When A Swf Is Clicked On?

Jan 5, 2010

Is there any way javascript can know when a swf is clicked on?

View 1 Replies View Related

Detecting Flash

Mar 26, 2001

I need to write a script that detects if a person has flash installed and if they do then do something, if not do something else.

I can do this no problem with javascript - except for the detecting flash part. I have no idea how to have a js detect flash - or even if its possible.

View 13 Replies View Related

Detecting It Is English Or Not

Apr 18, 2007

I like to detect whether the basic language of the client browser(O/S) is English or not .

The following would-be code doesn't work correctly, but it will show what I want. Code:

would-be code

<if it is English>

send to English version page

<else>

send to my mother tongue version page

</if>

View 1 Replies View Related

Detecting The Height Of A Div?

Mar 9, 2011

I have a dynamic web page with three vertical divs.

In the style attribute, I do not specify the div height because I don't know that until they're draw by the browser.

However, I'd like to add a fouth horizontal div acfross the bottom of the page at the bottom of the tallest of the vertical divs.

Is there any way to get the height of a div after it's drawn?

View 7 Replies View Related

IE Not Detecting OnChange Properly

Jul 23, 2005

If I detect an empty textbox, I fill it with a value ('Dad'). If I do this twice, the second time around IE 6 fails to notice that I've cleared the textbox again, thus leaving the textbox cleared. Is there a recommended workaround? Opera 7.23 is detecting the second deletion fine.

View 3 Replies View Related

Detecting 64-bit Windows Client

Jul 23, 2005

Can I rely on the following code to accurately detect a Windows 64-bit client?

var bWin64 = navigator.platform=="win64";

View 1 Replies View Related

Detecting Change In Textarea

Jul 23, 2005

I am trying to detect whether a user entered text in a textarea
or hit the delete/backspace button (thus, erasing something). Once
that is detected, I would like to set "var bSaveRequired = true;". It
would be great if this function worked cross-browser -- IE 6.0 and
Firefox.

View 1 Replies View Related

Detecting Domain Name Change

Jul 23, 2005

Say I'm on the site www.xyz.com and on a certain page if the user leaves the domain xyz.com, I have a popup cme up w/ stuff. I don't need to know what the new domain is, I just want to know if the user left / is leaving xyz.com.

View 1 Replies View Related

Detecting Stop Button

Mar 6, 2006

I'm trying to determine if the user clicks the
stop button during a post send, basically. Specifically, if a user is
uploading a file to my server, and they click stop at some point, I
need to be able to tell the server that stop was clicked, so it doesn't
think that's the whole file. I've noticed that an error message is
written to the Apache log, but that seems like a strange way to keep
track of user-interrupted events. (Note: this is Apache/mod_perl
server-side)

I guess what I'm thinking now is that JavaScript detects the stop
(since it is client-side), then sends a message to the server that an
error occurred, or something. Like I said, the onstop event is not
doing what I'm expecting, and Firefox doesn't like it anyway, not to
metion the other browsers out there. So my question is what's the
"idiom" or "standard way" of detecting this sort of situation. I'm
quite certain I'm not the first one to need it.

View 7 Replies View Related

Detecting User's Language?

Jul 11, 2006

If I want to detect a user's language, so that I can
change some text to suit them, how do I do that in
Javascript?

Or aren't modern browsers supposed to be able
to cope with more than one language on a page,
separated somehow by language identifiers,
and display only the appropriate text? Maybe
I was dreaming when I read that.

View 6 Replies View Related

Detecting Dynamic Page Changes

Apr 7, 2007

I'd like to be able to detect when page content is dynamically changed
by Javascript. I'd like to detect any changes to the content, such as
the addition of new DOM elements and when DOM elements that are hidden
are made visible (or vice versa). I will have no advance knowledge of
the scripts that will be run along with the script I will create.

I've implemented a solution that works reasonably well, but I'm not
sure if there are cases I'm not thinking of where it will fail, or if
there are more efficient means of doing the same thing.

My solution is to simply retrieve and periodically compare the content
of the innerHTML property of the main body tag elemnt.

So, summarized as follows:

function check() {
var bodyContent = document.getElementsByTagName('body')[0];
if(bodyContent != oldBodyContent) {
alert('body changed');
}
setTimeout(check, 500);
}

Is there a better way? What won't this catch?

View 1 Replies View Related

Detecting Htaccess Security

Oct 5, 2007

I am writing a script that uses xmlhttp.open, when i attempt to open a protected page I get the login prompt for my htpasswd. Is it possible to detect if there is a login requirement before the login prompt and if there is a login just do something else? I can use xmlhttp.status and check for 200 but if I do this then it would happen after the login prompt.

View 1 Replies View Related

Detecting The Protocol Of A Link

Jul 20, 2005

I'm making an Intranet site for someone who is not very familiar wit
making websites, thus I would like to make it as simple as possible fo
her when she needs to update it.

The intranet site uses frames - one menu frame that is always present
and one frame into which the content is loaded. The intranet sit
features many, many links to both internal and external pages - i
internal pages within the intranet and external pages on the interne
(http://)

What I would like to do is make it so that if a link is internal, th
content will load into the content frame and the menu frame will remai
at the side, but if the link is external, it will load the target int
the entire browser window. Using HTML, this would simply be a matter o
stating the href and then target="content_frame" for internal pages o
target="_top" for external pages.

But, like I said, I am making this site for someone who is not familia
with linking targets and even if I told her to define the targe
whenever she makes a link, she'd probably forget or get confused an
then wonder why external pages are loading with the intranet menu fram
still present or why intranet pages are loading with no menu at th
side!

While I have good experience with HTML, I am fairly new to JavaScript
which is why I am here asking for help.

I understand that Javascript can detect the protocol of a link,
believe you would use "link.protocol". In basic terms, what I woul
like to do is:

if link.protocol = "http://" then target="_top" els
target="content_frame"

But since I'm not familiar with the precise way of coding JavaScript,
would just like some help with transforming this into correc
JavaScript code so that it will work.

View 1 Replies View Related

Detecting When Back Has Been Pressed?

Aug 8, 2009

I've written a script that displays tooltips when your mouse hovers over a link - all this is fine, but when I click on the link and move to another page, then click the back button on the browser to go back, the tooltip for the link I clicked is still visible! It'd be great if there was a way of detecting the button had been pressed so that I can hide it...

p.s. I tried onclick = "tooltips.hideToolTip(4); return true;" for the links but no joy...

View 1 Replies View Related

Detecting The Parent URL With Strstr In JS?

Jan 29, 2010

I am trying to detect the parent URL on a page for a Facebook application so that if the user is on my site rather than accessing the application via Facebook they will be redirected to the FB App page.

In PHP I can use: if(strstr($parenturl,"mysite.com")){header("location:fbapp.com");exit;}

Is it possible to do this in JS also? Because with FB Apps the URL is not always the same so instead of detecting a full URL I just want to search for my domain name within document.location.href to see if it exists and IF yes > Redirect back to FB.

View 2 Replies View Related

Detecting Double-press Of A Key

Dec 31, 2010

I want to detect the double-press of the space key. However, I want a single press of a space key to have a different function. The double-tap of space should only count if the taps of space are no more than, say, a half second apart.

For example: The user hits space once, and javascript begins performing one action. 1/3rd of a second later, they hit the space bar again, and since that is within our threshold of 1/2 of a second, the action that began because the user hit the spacebar once should be cancelled, or undone (which I can write later) and the action when the user hits the spacebar twice should begin.

View 7 Replies View Related

Detecting The Cursor Position

Feb 6, 2008

I have created a nice blog form for my users and I would like them to be able to use some aspects of HTML code that I have styled and they can utilise. The way I have this set up at the moment is, much like th reply boxes here, they can click on a button and the code (such as ) is automatically added to the textarea. The problem I have at the moment is that the cursor goes to the end of the content written so far and places whatever they have clicked at the end. I would like to be able to detect the cursor position and then they can add the various tags where they want them.

Also, is there a way I can get the cursor to automatically sit between the opening and closing tags that are generated (as can be seen here)??

function writeCodeTag(code) {
var cache = document.getElementById('f').article.value;
this.code = code;
document.getElementById('f').article.value = cache + code;
document.getElementById('f').article.focus();
}

This function adds the various code tags to the textarea... I have the same sort of thing for smilies.

View 1 Replies View Related

Detecting Scroll-bars On DIV

Jul 22, 2004

I having a wrapper DIV (certain width say 400px) and i have some child DIVS which i want to add to it. And i want it to have a maximum height of 600px say.

I DONT want the wrapper DIV to have vertical scroll bars so i would like to add as many child DIVS (which contain text of indiscriminant length) until i can somehow detect that the wrapper has overflowed (ie the scrollbars have been implemented !) if it has then remove the last one and dynmically create a new DIV, and continue the cyclw until exhausted of child DIVS. Code:

View 1 Replies View Related

Detecting Website To Be Up Using Javascript

Sep 13, 2006

Does anyone here know of a way using javascript to detect if a specific website is up (by accessing a specific url for example), and then once it responds to redirect the user to it?

View 5 Replies View Related

Detecting Keystrokes In Firefox?

Jul 27, 2009

I'm trying to detect keystrokes using Javascript. My code (so far) works in Opera and Safari, but not in Firefox, Netscape/SeaMonkey/Mozilla, or Chrome. (I have no idea if it works in IE; IE has other problems with my code.)What I've done is attached a onkeydown listener to the body tag. (I've also tried it with onkeypress and onkeyup.) Right now all I'm trying to do is detect a key press -- any key press -- and throw an alert as a result. I've tried it two separate ways -- with straight Javascript and with MooTools, which I'm using for the rest of my project.

The code I have is as follows:

mootools version
$(document.getElementsByTagName('body')[0]).addEvent('keypress', function(event) { alert('key has been pressed.'); });
regular javascript version
document.getElementsByTagName('body')[0].addEventListener("keypress", function() { alert('key has been pressed.'); }, false);

Both versions work in Opera and Safari. Interestingly enough, if I attach a click listener to the body using the exact same code as above, but changing the word 'keypress' to 'click', they both work in Firefox as well. I can't figure out how to get this key listener attached.

View 7 Replies View Related

Detecting When Someone Leaves The Website

Jul 16, 2009

I'm trying to detect when someone leaves a certain website. and this works:

<body onbeforeunload="showUnloading(event);" >
function showUnloading(evt){
evt.returnValue = "Are you sure you want to leave?";
}

However if someone clicks on a link within my site. That goes to another page in the website it treats it as if someone is leaving my website.

View 24 Replies View Related

Detecting Text Overflow?

Apr 5, 2010

I have a width limited box on a website that contains text. Normally the text will break across several lines as expect just fine. However, every now and then there is a really long word that breaks out of the box:

Code:
|--------------------------|
| Some would say that |

[code]....

View 16 Replies View Related







Copyrights 2005-15 www.BigResource.com, All rights reserved