Xtreme Visual Basic Talk

Xtreme Visual Basic Talk (http://www.xtremevbtalk.com/)
-   ASP.Net (http://www.xtremevbtalk.com/asp-net/)
-   -   javascript and Chrome (http://www.xtremevbtalk.com/asp-net/326428-javascript-chrome.html)

pgollnic 09-16-2013 01:18 PM

javascript and Chrome
 
Why does not CHROME recognize this?

<script type="text/javascript" language="javascript">
function convertquotetospace()
{ if (event.keyCode == 39) { event.keyCode = 94; } }
document.onkeypress = convertquotetospace;
</script>

In every other browser if a ' is entered it converts it to a ^

why .. or what else to do? I want it in the html

gollnick

lamy 12-02-2013 08:47 PM

each browser being a different animal on its own behaves differently, you need to do a test on several (major/popular) browsers

now to fix that code of yours you can do this, tried it with Chrome

Code:

function convertquotetospace(charCode) {
        if (charCode == 39)
                charCode = 94;
        return charCode;
}

document.onkeypress = function(evt) {
        evt = evt || window.event;
        var charCode = evt.which || evt.keyCode;
        charCode = convertquotetospace(charCode);       
        return charCode;
}



All times are GMT -6. The time now is 05:10 PM.

Powered by vBulletin® Version 3.8.9
Copyright ©2000 - 2017, vBulletin Solutions, Inc.
Search Engine Optimisation provided by DragonByte SEO v2.0.15 (Lite) - vBulletin Mods & Addons Copyright © 2017 DragonByte Technologies Ltd.
All site content is protected by the Digital Millenium Act of 1998. Copyright©2001-2011 MAS Media Inc. and Extreme Visual Basic Forum. All rights reserved.
You may not copy or reproduce any portion of this site without written consent.