KeyPress Capitalize Function Broken In IE9

Oct 10, 2011

A common javascript function that capitalizes input as user types (onkeypress) no longer works as of IE9Need a function that also works in IE 9 that doesn't not change method call or interface (as it's used in 150 places throughout application).

CALL:
[CODE]
el.onkeypress = function(el) {
return c_capitalizeInput(el);
}
[CODE]
FUNCTION:
[CODE]
// Intercepts keyboard input and capitalizes keystrokes.
// Call with onkeypress="return capitalizeInput(event);"
// Compatible with both IE and Netscape/Mozilla
function c_capitalizeInput(evt) {
evt = (evt) ? evt : ((window.event) ? window.event : "");
if (window.event) {
// IE
if ((evt.keyCode >= 97) && (evt.keyCode <= 122)) {
evt.keyCode = evt.keyCode - 32;
} return true;
} else if (evt.which) {
// Netscape and Mozilla
key = evt.which;
if ((key >= 97) && (key <= 122)) {
key = key - 32;
evt.target.value = evt.target.value + String.fromCharCode(key);
return false;
} return true;
} else {
return true;
// Can't do anything for other browsers
}
}
[CODE]
How to make this work in IE9?

View 19 Replies


ADVERTISEMENT

Position Reporting Function: Flanagan, Yahoo!, Kruze, Prototype ... All Broken At Least A Little.

Oct 9, 2006

It seems like determining element position in a web page is a difficult
task. In the position reporting source code I've looked at there are
special fixes for at least some versions of Safari and Opera. I am
doing a lot of dragdrop experimentation and in some situations need a
position reporting function. The function doesn't need to report the
positions of exotic elements like images in button elements; however, I
would like a position reporting function that can at least handle
combinations of scrollable elements and tables....

View 2 Replies View Related

Creating Function For Button Click On Enter KeyPress

Nov 18, 2009

I have 3 button controls on my asp.net web page. This r html controls one of them I have set to default on form load. Using javascript how do I set the other 2 button to be clicked when it has focus & enter key is pressed.

View 4 Replies View Related

Page Capturing All Onkeypress Events By Calling Function KeyPress?

Sep 5, 2009

I am currently trying to figure out some event stuff with Javascript. I have the page capturing all onkeypress events by calling my function keyPress, and passing the event as an argument.

The key presses get passed to a text field that I have on the page (even if it's out of focus at the time of the key press) by using textfield.focus() within my keyPress function. This seems to pass the event along to the text field so that it registers the stroke and handles it as if the field was in focus at the time of the key press.

My problem lies in that I need to then grab the new value of the text field for use with another part of the script. It seems though that with the way I'm setting focus, it'll execute the rest of my keyPress function (with the outdated text field value) before the text field handles the event.

Is there a way to yield the event to this text field first?

Sorry, this was a long post, but I guess here's a short recap: If I handle key presses via the body of the page, so that regardless of the text field's current state of focus it updates the text field accordingly, is there a way to have that happen first before the rest of my function that needs to use the new value of the text field?

View 3 Replies View Related

Auto-Capitalize

Jul 23, 2005

I have a nice little Javascript that capitalizes each field in my form
submissions. It looks like this:

<cfscript>
function CapFirst(str) {
var result = Trim(str);
var wordCount = ListLen(result," ");
var ProperString = "";
for(i=1;i LTE wordCount;i=i+1) {
ProperString = ProperString & " " & UCase(Left(ListGetAt(result,i,"
"),1)) & LCase(RemoveChars(ListGetAt(result,i," "),1,1));
} ProperString = Trim(ProperString);
return ProperString;}
</cfscript>

Then I display the results as follows:
#CapFirst(Session.Customer.FirstName)#

It works fantastic, except for some reason on my final form submission,

if someone enters an apostrophe in the field, it wants to repeat it 8
times. So the name "O'Brien" will look like "O''''''''brien". I can
live with the second character being lowercase, but the repeating
apostrophe's have to go.

View 4 Replies View Related

Capitalize All Form Fields?

May 27, 2007

I would like to CAP all form field data when the form is submitted. Is there an easy way of doing this?

View 1 Replies View Related

Capitalize The First Letter Of A Last Name With A Twist

Mar 24, 2006

I need to capitalize the 1st letter of a last name and if that last name is hyphenated capitalize the first letter after the hyphen too.

View 2 Replies View Related

Using Split / Join And Loop To Capitalize User Input

Oct 22, 2011

I need to capitalize user input from a text field by passing the data to an array and using the split() method, then then join() method and of course toUpperCase. I need to accomplish this with a loop. I only have a crappy ebook and haven't ever been in a java classroom.

Here's what I have which is not at all sufficient. I learn best from examples, so here I am...
<HTML><HEAD>
</HEAD><BODY>
<FORM ACTION="#" NAME=strn>
Enter lower case text
<INPUT TYPE=TEXT NAME="txt1" SIZE=20>
/

The following lines of code are just my attempts at guessing javascript logic/syntax
function arrays(){
for (var i=0; i<secondarray.length; ++i)}
firstarray=getElementByName.txt1
var secondarray =firstarray.split(separator[" ", 40]).toUpperCase();
/var secondarray.join([""])
<BR><BR>
<INPUT TYPE=BUTTON VALUE="Convert to Upper Case"
onclick="document.strn.txt2.value = document.strn.txt1.value.toUpperCase()"
<BR><BR>
<input type = "text" NAME=txt2 size=20/>
</FORM></BODY></HTML>
I know this much .array = string.split(separator[, limit]);.

View 4 Replies View Related

JQuery :: Use The Keypress Function With The "esc" Key?

Jan 4, 2012

i am building a site for a client and they want to have their users be able to get out of their site just by pressing the "esc" key. is that possible?

View 9 Replies View Related

Replace Broken Images?

Oct 17, 2005

Not sure if this can be done with javascript but I would like to find a way to detect if an image is missing and replace it with a default image instead of the dreaded RED X showing up.

So - Is Javascript the way? Or should I look elesewhere?

View 15 Replies View Related

How To Hide Broken Links?

Jul 20, 2005

I have an html file which links to word docs amongst other things; but
these files and their location may change periodically.

How can I adapt my html so that if the files do not exist, the links
are hidden i.e. how do I hide broken links?

View 1 Replies View Related

Ajax :: Broken Url GET Parametes?

Nov 18, 2009

I have a problem with an ajax application using jquery.Depending on the responseText I want to load another page into a containerA response created by php can look like this:redir@test.php?a=1&b=2&c=3I parse it with javascript as follows:

Code:
function parseInput(responseText){
var redir= /redir@/;

[code]....

View 4 Replies View Related

AJAX :: CSS Broken After Call?

Apr 6, 2011

l am making an jax call and the data is coming back fine inserted into the specific div correctly.However my css is broken after the AJAX call. the h1 are too big some menu items disppear.See code below

jQuery('#section').change(function()
{
jQuery('#loading')

[code]....

View 1 Replies View Related

JScript Ad SERVICE Broken?

Jan 14, 2010

Code attached, the bb code dosen't let my code post.

View 2 Replies View Related

JQuery :: Broken Links In Documentation?

Jun 30, 2011

Seehttp://api.jquery.com/category/deferred-object/links tohttp://api.jquery.com/jQuery.thenhttp://api.jquery.com/jQuery.doneetc don't work.

Is it possible to post a patch to the docs somewhere?

View 1 Replies View Related

JQuery :: Documentation Pages Broken?

Apr 5, 2011

Is it just me, or can no one else see the content of the documentation pages?All I get is a blank window. I've tried multiple browsers on multiple computers with no difference.

View 5 Replies View Related

JQuery :: $.getJSON From Subdomain Broken In 1.5

Feb 3, 2011

In jQuery 1.4.4 I could load a JSON file from subdomain2.website.com to subdomain1.website.com without any problems. When I upgraded to jQuery 1.5 this didn't work anymore.

Is this a jQuery bug

$.getJSON("http://subdomain2.website.com/resources/data.json", function( data ) {
console.log("data");
});

View 4 Replies View Related

JQuery :: Broken In IE And Chrome But Not Firefox?

May 29, 2009

I have an issue in which any and all jQuery function calls are broken in Internet Explorer and Google Chrome but it functions properly in Firefox and even Firefox doesn't give me any Javascript errors.[URL]..

View 1 Replies View Related

JQuery :: Firefox Extension Is Broken In V1.3.2 ?

Apr 3, 2009

I am developing a Firefox extension and after upgrading from jQuery v1.2.6 to v1.3.2 I found that including jQuery in the XUL-file will break other extensions that displays buttons on the toolbar, among those is Adblock Plus.

I have not tried any versions between those mentioned so I do not know in what version this happened. If i revert to v1.2.6 everything is OK.

View 6 Replies View Related

Scale Broken In IE7 When Using Origin Argument

Mar 19, 2010

I've been trying to show a div using jQuery's show function with the scale effect. My code works fine in Firefox. When I test it in IE7, it breaks. I narrowed it down to either the origin argument of the scale effect, or the time argument of the show function (which seems unlikely). Like this:

Works in IE7, italics added to show commented code better:

Code:
$(document).ready(function() {
$("#hover").hover(
function() {$("#content_show").show("scale",{percent: 100, direction: 'vertical'});},//, origin: ['center','center']},500);},

[Code]....

Also, not as important, but what is the syntax of the origin property? What values can I use in it?

View 2 Replies View Related

Tabs Found On Webpage Broken In IE9?

Jun 15, 2011

I have had a report that the tabs (product description, shipping etc.) found on this page don't work:
JCDC x odm collection - UFO - Black
I have checked on quite a few browsers and it seems fine. The person who reported it appears to be using IE9 which I don't have access to.

View 1 Replies View Related

Show Broken Image Links In FF?

Apr 4, 2011

I found, after some googling, a js that shows broken image links in FF. I wonder if its possible to alter it so that the script displays the broken link image in the same size as the original image is in. Now it makes it in to 80x80px [code]...

View 6 Replies View Related

JQuery :: Button Background Broken For Icon?

Mar 25, 2011

I have abutton with an icon and the icon is displaced, when it is placed inside a span that has the class ui-widget-content

I believe that this person was having the same issue[URL]...I could just use a different class for the span,I just wondered if there was a

[Code]...

View 1 Replies View Related

AJAX :: Way To Notify A User If A Connection Is Broken

Nov 28, 2010

I was wondering if there's a quick and simple way to notify a user if an ajax connection is broken, for example you're calling a file, but due to your internet connection, the file cannot be relayed back to you, so the existed javascript code on the initial page you're on, notifys you of the problem.

View 1 Replies View Related

JQuery :: Broken Links In Dynamically Loaded Pages?

Oct 29, 2009

When I load an HTML file dynamically which contain relative links with jQuery, all the links are broken. which does not involve changing all the links to absolute values?

View 1 Replies View Related

JQuery :: $.post Callback Broken In Safari In New Window.open()

Jul 9, 2009

I'm opening a new window with window.open() In the new window a file is loaded with the following post data function:

function ajaxPost(url,data){
$.post(url,data,
function(data){
alert(data)

[Code]....

If I call this function form within the new window everything is fine

- If I call it from the opener window the callback function is broken

- only in safari - ff works fine.

View 1 Replies View Related







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