Redirect Input To Accelerator (accessKey)
Mar 23, 2006
Short version: if the user types an alt+ctrl+char combination which
leads to a defined character, but s/he's not in a input(text)/textarea,
then I'd like that keystroke combination to do the same action that it
would have done had there not been a defined character.
Longer explanation: I've got a US keyboard and a pseudo
Hungarian/German keyboard (I combined them). The extra keys on the
European keyboard are entered via alt+ctrl+char and
alt+ctrl+shift+char. Now when you define an access key in FF or IE,
the browser tends to care about alt+char being pressed. If ctrl or
shift are there, too, they can come along for the ride. However, if I
have this key combination mapped to something in the operating system,
then the mapping takes priority and the accelerator is ignored.
My question is how to get FF's "default" behaviour of trying the access
key when I'm not in a text input or textarea. The reason I think I
might have a fighting chance is that if I stick an alert('hi mom') in
the onkeydown event handler, then the element with the accelerator is
activated. I just don't know how to bypass having to use the alert.
The example below assumes that alt+ctrl+g maps onto a key which will
display in the input (with my European mapping it maps to §). If it's
not true for you, then you won't see any issues on your system (for
example, on my US keyboard mapping). In that case, one should select
another letter as the access key (go to a text area and start typing
alt+ctrl combinations till something displays), and change the 7th line
in the page below:
<html><head><title>Accesskey testing</title></head>
<body onkeydown="keyDowned(event)"
onload="document.getElementById('cb').focus()">
<form name=foo action="" method=get>
<input type=text id=txt name=txt>
<input type=checkbox id=cb name=cb><br><br>
<button type=button id=btn accesskey=g
onclick="alert('Btn activated')">
<u>G</u>o for it</button>
</form>
<div id=log>Log:</div>
<script type='text/javascript'>
function keyDowned(evt) {
evt = evt || window.event;
document.getElementById('log').innerHTML += "[" +
evt.which + ", " + evt.keyCode + ", " + evt.charCode + "] ";
if (evt.altKey && evt.keyCode>19 && evt.target) &&
evt.target.nodeName!="TEXTAREA" &&
(evt.target.nodeName!="INPUT" ||
evt.target.type!="text")) {
// allows default handling to act?
alert('about to activate');
}
}
</script>
</body></head>
View 1 Replies
ADVERTISEMENT
Dec 5, 2011
I have a date controll.. ie dd/mm/yyyy and for each i have + and - buttons. On clicking + the value increses by 1 now. So for large changes.. like if i want to change 2011 to 1955 i want to click lot of times. I need a function to controll that.. When i click and hold the button i need the +/- button to be increased in exponential manner. For single clicks i need to increase 1 by 1.
View 10 Replies
View Related
Dec 7, 2006
Is there any way to get 'accesskey' to work with document.location.href?
I'm using a set of functions as link generators and this is what I'm "stuck with" using.
View 3 Replies
View Related
Aug 25, 2010
problem with accessKey attribute value p (lowercase) and P(uppercase) for different html buttons.. the browser unable to differentiate between upper and lowercase key ...
i have a simple form with two buttons, and i want to trigger these buttons with keyboard keys in combination with Alt key. for example Alt + P (uppercase) should trigger button 1 and Alt + p (lowercase) should trigger button 2
Browser: IE 8.0
here is the code...
-----------------------
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
[Code]....
here the behavior is strange, when i press Alt+P in keyboard, button1 is triggered and when i press Alt+Shift+P in keyboard, button2 is triggered ..
View 1 Replies
View Related
Oct 11, 2011
I need the code for if the user enters in a code into the field for example E1 and clicks submit it'll redirect them to a certain form. And if another user entered in E2 it would redirect them to a DIFFERENT form.
View 2 Replies
View Related
May 11, 2010
I'm trying to write very basic page that just takes input from a text box, processes it with a function called DoSearch() when you click the submit button, then redirects to the Google equivalent to display Google's search results. If I put a redirect in the body section it works fine. I've also added an alert in the function and that works fine, but the redirect doesn't. I'll post the source below because it's only short:
HTML Code:
<html>
<head>
<title>Homepage!</title>
<script type="text/JavaScript" language="javascript">
function DoSearch(){
var query = document.SearchForm.query.value;
var url = "[URL]"+query+"&aq=f&aqi=g10&aql=&oq=&gs_rfai=";
alert(url);
location.replace("[URL]");
}
</script>
</head>
<body>
<center>
<form name="SearchForm">
<input type="submit" value="Search!" name="Search" onclick="DoSearch()" />
<input type="textarea" name="query" size="38" />
</form>
</center>
</body>
</html>
View 4 Replies
View Related
Jun 29, 2010
I'm trying to get Jquery's Autocomplete to redirect a user based on their input - according to Jquery, it works like this: An autocomplete plugin can be used to search for a term and redirect to a page associated with a resulting item. The following is one way to achieve the redirect:
[Code]....
View 7 Replies
View Related
Jun 30, 2009
I am having a problem with the following script. It sometimes works and sometimes does not. For instance, I placed the HTML code on my desktop and saved the text as .htm-
Open the file in IE and click to accept blocked content. Then I entered a number. Sometimes it works and goes to the document.location url.. but sometimes it just goes to code...
View 1 Replies
View Related
Jun 6, 2009
Im looking for a simple code to redirect to a specific URL on any click on page and redirect to certain url after a certain number of page views.
View 18 Replies
View Related
Oct 7, 2009
javascript:history.go(-2) makes it go two pages back for links but how do u put it in the script tags just when the page loads go back 2 pages?
View 1 Replies
View Related
Apr 19, 2010
I have a javascript that I found for an iphone style menu. It works and allows me to click through the menu as long as it is within the list system. If I try to create an external link to a webpage. It doesn't load anything. Here is the code let me know if anyone knows the trick so I can link out. Below is the javascript used to create the flowing menu system. Let me know if you need the rest of the .css and html.
(function() {
var animateX = -20;
var animateInterval = 24;
var currentPage = null;
var currentDialog = null;
var currentWidth = 0;
var currentHash = location.hash;
var hashPrefix = "#_";
var pageHistory = [];
[Code]...
View 1 Replies
View Related
Jul 15, 2002
Perhaps this is a silly question (if so I apologise in advance), but I'm a low-level paper-shifter/part-time Web designer in UK Government and I've designed our Company's site.
Problem is like most Government Depts. trying to do anything involves much liasing with other Depts and much paper-shifting.
We have no Servers or Hosting capability ourselves so this part of the site is handled by (guess what?) another Government dept.
Many months ago I asked them to put a redirect on a number of older URLS for our site which were still being linked to by a large number of other sites.
I was reliably informed this had been done and checked the URLS and all seemed okay.
However I have just recently done a search for our site on AltaVista and the top hit is a subdirectory of the old URL with no re-direct seemingly in existence.
Question is if you put a redirect on a particular URL will it/should it always also include the subdirectories within that URL?
View 4 Replies
View Related
Jun 7, 2010
I am having a form with two input fields. I want to enter some text in the first input field and then the second field should get the same text. Is there a simple way (maybe a plugin) to do this with jQuery? It would be perfect if I even could output all these input fields values as normal text in <p> or <li> tags.
View 2 Replies
View Related
Jul 23, 2005
I am trying to use the onunload event to know when the user closes a
popup by receiving a request on the web server.
I have a main page from where the user opens a popup. What I want is
when the user closes the popup, it sends a request to my web server
(GoAhead) using the onunload event, then closes the popup.
For the moment, this what i have: when the user closes the popup, I
use the onunload event to open a different popup (by this way, I get a
request on the web server and I know that the user closes the first
popup), then, this new popup closes itself with the onload event. It
is working but having this second popup opening and closing is not
very neat.
If I try to change the location of the first popup in the onunload
event: onunload="document.location='....'", it doesn't send a request
to the web server when the user closes the popup.
Is there a way to send a request to the webserver when the user closes
the popup without the need to have an extra popup opened and closed ?
The web server I am using is working on a pseudo "cgi" mode called
"goforms", it avoids to create a different process for each request.
With "goforms", each request is handled by a unique process which is
always running.
View 3 Replies
View Related
May 18, 2006
I hava a snippet below. This code will
redirect my current web page to http://www.xyz.com . . .
But I want to specify the number of seconds before it is redirected.
May I know how to do this? (As much as possible, meta tags should not
be used.)
<SCRIPT LANGUAGE="JavaScript">
<!--
window.location="http://www.test123test1111.com";
// -->
</script>
View 8 Replies
View Related
Sep 13, 2006
My objective is to redirect to another web page after download is
complete.
I have an activeX called to download a few dlls using the following
code
document.writeln(' <OBJECT ID="MQC" ');
document.writeln(' CLASSID="CLSID:98c53984-8bf8-4d11-9b1c-c324fca9ca"
');
document.writeln(' CODEBASE="test.ocx#Version=9,1,0,4359"');
document.writeln(' WIDTH=100% ');
document.writeln(' HEIGHT=100% >');
document.writeln(' <PARAM NAME="DomainPassword" value=""');
document.writeln(' <PARAM NAME="RootURL" value="' + getTdRootURL()
+'"');
document.writeln(' </OBJECT>');
I tried redirecting in the onLoad event of the form but doesn't work. I
suppose it redirects as soon as the activeX is loaded and not when it
has finished its download.
View 1 Replies
View Related
Nov 28, 2006
I would like to redirect say from http://mysite.co.uk to
http://www.mysite.co.uk but because my home page is html I have to use JS
View 5 Replies
View Related
Mar 30, 2010
I have a form in which i have a dropdown list and a submit button. I want to code so that when users select the value from the dropdown list, it should redirect then to the specified page. For instance i have the value, "car", "House" and "pets" in my dropdown listbox, if a use click on "car" it should redirect them to the car page. I have done the following code, but something seems not to work :(
And in the submit button am calling the function move()
My form name is sell and the dropdown list menu is cat.
View 4 Replies
View Related
Jul 21, 2011
I have data pages in my e-commerce site (from 1999) that are imbedded in a parent page using the object tag. I have started to include a little JS snippet that is intended to redirect to the parent if the embedded pages are loaded separately:
<script language="JavaScript" type="text/javascript">
try { if (top == self) {top.location.href='parentpage.htm'; } } catch(er) { }
</script>
This works fine in Firefox, but in IE 7 and 8 it gets into an infinite loop of reloading the parent page into the object frame.Here is a sample:http://www.greathallminis.com/Ancient_15mm/darkages_anc15_mm.htm(I've left this page with the issue, while I have excluded the script for IE elsewhere.)
View 3 Replies
View Related
Sep 23, 2011
I have a code here:
<input type="submit" class="submitblog" onclick="document.getElementById('entry_draft').value=0; document.forms['frmNewBlog'].submit();return false;" value="Submit" />
How can i add a redirect page? I mean what is the code that i will add so that when my user click's submit, they will redirect to example.com/mypage
View 4 Replies
View Related
Aug 17, 2010
I'm trying to redirect away from a page using AJAX, and I'm having a tough time figuring out how to do it properly. From what I understand, an AJAX request thinks it's done when a script echoes something, so this is what I have, for the script run behind the scenes and the HTML with AJAX:
PHP:
<?php
Some code
[code]....
I think what's happening here is that the Location header in the PHP is overwriting the echo, since I'm calling the Run.php script twice, so the AJAX request never knows it's ready. This also means, I think, that I'm missing something fundamental about how AJAX works, and I'm doing the redirection wrong
View 10 Replies
View Related
May 3, 2004
I wonder if someone knows where I can find a snippet of code or if someone has something available real handy.
I have been authorized to sell a company's products. I am offering them to my own affiliates. I do not want them to by-pass me and go to the source as this is a trial and the company only wants to deal with one person right now. They are not sure if they want to do this long-term and set up a program./
So I need to take the code they supply and have it redirect to my URL and append or add the affiliate's ID on the end. That way, the affiliate or whoever would only see my URL.
Is this possible and can someone point me in the right direction. I may be mistaken but I think a line of javascript or php might do the trick.
View 2 Replies
View Related
Sep 15, 2005
Is there a bit of javascript i can use to redirect the user back to the index page if the page they typed in does not exist? (hosted on windows server)
eg:- if the address typed in is; www.somewhere.co.uk/cheese.htm; and ...cheese.htm does not exist it then goes back to the index page
View 3 Replies
View Related
Oct 17, 2005
I have a page that opens up a popup window after clicking a button. I want to test if the parent/previous page is a certain page when the popup window loads and if it is not then I don't want the popup window to open. I also want the page to redirect if a person just puts the popwindow address into their browser. I am working with asp.net vb and I am told javascript is the best way to do this. I know enough to open the popup window using javascript and that is about it.
View 4 Replies
View Related
Jul 23, 2006
I have some pages with urls like link.php?linkid=4 for example. This is a framed page that has the top frame url topframe.php?linkid=4 , and the bottom page fetched from elsewhere.
The problem I have is that at the moment (slowly getting better) Google has mainly indexed the topframe.php urls, not the link.php ones, so anyone clicking on the result just gets the top frame, which is useless on its own.
Does anyone know of, or could help me write (given I'm useless at javascript) a script that I could place in topframe.phpid=x, which would redirect to link.php?id=x if it is not opened as part of a frameset?
View 2 Replies
View Related
Sep 14, 2009
Working on the basis that MOST Internet users to visit the site I have built, have IE6 or later, I would like to add a browser-detect capability that ONLY focuses on IE6 and sends the user straight away to the alternative page. If using a browser older than IE6 neither the real page, nor the alternative, will work anyway, so it doesn't matter which one fails for them. I've lost my Javascript book (shoot me in the head!) and trying to find browser detect code online, I keep finding massive reams of code where the intention is to detect exactly which browser is being used. I'm not bothered, unless its IE6.
The site works fine in Opera, Firefox and IE8, I had to tweak it slightly to work fine in IE7, but for IE6 it would completely ruin the feel of the site for everyone else if I were to tweak the main site. So, please if someone could paste the code that would say "If user's browser is IE6, then auto-redirect to this page",
View 4 Replies
View Related