Way To Disable Backspace
Jun 25, 2004Just a quicky how can i disable the backspace. I have found code for the enter key but dont understand it. code...
View 10 RepliesJust a quicky how can i disable the backspace. I have found code for the enter key but dont understand it. code...
View 10 Replies<script language="javascript">
function disableback(evt) {
if (evt.keyCode == 8 || evt.which == 8) {
return false; /*have also tried return (evt.keyCode != 8) and evt.which == 46 and the variations*/
}}
</script>
<input type="text" onkeydown="disableback(event)" onkeypress="disableback(event)">
I am doing my testing on Firefox. From posts this should work to stop from the page going back yet no dice. I currently have the text area in a frame and have it reload keeping all text in a variable, it just seems awful sloppy.
This may work on IE, have yet to test. Just trying for FF atm.
I've been getting some complaints from my users: when filling out forms, while on a select box, pressing the backspace key would actually mimick pressing the back button (like history.go(-1) ...)
Then I realized that if the user wasn't in a textbox or a textarea, pressing the backspace key would send them back one page. Now I've got a multi-page form in an iFrame and that's really screwing their inputs up as it loses all the information entered in that form (pressing back doesn't submit/post backwards... I wish it would!).
So anyway, here's the script I'm using on all my pages so that the user won't 'accidentally' go back a page. (In my opinion, with my users anyway, a user shouldn't need to hit the backspace unless they're in a textbox or a textarea).
//so backspace doesn't go back
document.onkeydown = checkForBackspace;
function checkForBackspace() {
//we can backspace in a textbox
if(window.event.srcElement.type.match("text")) {
return true;
}
if(window.event && window.event.keyCode == 8) {
// try to cancel the backspace
window.event.cancelBubble = true;
window.event.returnValue = false;
return false;
}
}
This is IE only. srcElement is an IE thing.. I believe most other browsers use target. I don't know what else would be different, but anyway, that's what I'm using.
BTW: If you're wondering why anyone would press backspace in a selectbox, well I recently showed them that you can press the first letter of an item in the list to quickly jump to that item. Well, perhaps naturally, if they press the wrong key, instead of pressing the right key, they try to hit backspace first. Just if you were curious... I guess checkboxes and radios could be similar?
In my web application(ASP.net), i need to disable the "Back" button in the browser.Moreover i also need to disable the Backspace key in my keyboard when my web page is run..How to do it with javascript..?
View 9 Replies View RelatedIm trying to find a way to disable the keyboard backspace button from going back a page but allowing it to go back a character.
The problem happens with our webmail client when composing a message, if the cursor is not in the textarea and backspace is clicked it goes back a page and everything typed in the textarea is lost, its easy to do because we use a cms menu thats always active, and distract the cursor, and its very frustrating. Code:
This JS limits the input characters into the form. How do I modify it
so that it also allows CARRIAGE RETURN and BACKSPACE (for making text
correction)?
Due to the template engine I am using, I cannot use IF/ELSE statement.
<form>
<textarea name="event_description" ONKEYPRESS="if (document.layers)
var c = event.which;
else if (document.all)
var c = event.keyCode;
else
var c = event.charCode;
var s = String.fromCharCode(c);
return /[0-9a-zA-Zs,.?!@#$%&*()-]/.test(s);"></
textarea>
</form>
I have created a keyboard on Taco HTML via a table of buttons and within this keyboard I need a functioning Backspace button using javascript. I currently have a 'reset' button which clears all of the values in the text box.
View 3 Replies View RelatedCould someone point me in the right direction for making a key function that removes one character from the beginning of a string every time it is pressed (basically the exact opposite of a backspace key)?
View 3 Replies View RelatedI have to go back to specific page(html page) using backspace button in javascript n html.
View 4 Replies View RelatedI have a keypad that inserts a number into a div (simulates pin number). How do i create a "backspace" or delete button that will remove the last character added.[code]...
View 4 Replies View RelatedI'm using the below to limit the input into a text box to just letters,
numbers, hyphens and full stops, but I also need to allow the backspace,
delete and arrow keys to come through. How can I do this?
<script language="JavaScript" type="text/javascript">
<!--
function onKeyPressBlockNumbers(e)
{
var key = window.event ? e.keyCode : e.which;
var keychar = String.fromCharCode(key);
reg = /^[.a-zA-Z0-9_-]*$/;
return reg.test(keychar);
}
//-->
</script>
<form>
<input type="text" onkeypress="return onKeyPressBlockNumbers(event);" />
</form>
I have a modal window with a few textboxes, one button and a few labels. I need to disable the backspace key, unless any of textboxes is in focus, if this the case, user allows to delete the text from the textbox.
View 3 Replies View RelatedWhen i have:title="test|contentwithoutspaceeeeeeeee">hover</a>if the width of the text is more bigger than the configuration ofcluetip, the text continues out of cluetip box.Have one way to solve that?
View 2 Replies View RelatedI have a form element that is readonly. <input type="text" id="kfs_acct_1" readonly="false" /> This field is dynamically populated an making it readonly prevents users from changing the value in this field. The problem I have is users click on the field and try to delete it's value. They click in the field and hit their Backspace key. This takes them away from the page to the page from whence they came. Because of the way the form is set up, doing this makes them loose all the data in the form (the one with the readonly box). How can I prevent the Backspace key from fireing and taking the user away from this page? I've tried a few things, but apparently making a field readonly keeps some key events from being seen.
[Code]...
I'm using Firefox 3.5.5 on Vista 32 Home Premium SP2 and only recently noticed that (javascript/jquery being enabled) link focus is lost when you tab through a page, follow the link to another page and then hit the backspace key to come back. Tab navigation continues at top of page, not with the next link after the one in focus before.
No problems in this respect with IE8 and Opera. As soon as you disable javascript with noscript, the problem disappears and link focus stays, so that tabbing brings on the next link instead of starting on top of page again.
Just confirmed it on jquery/com (following navigation link to Plugins and hitting backspace) and on learningjquery/com (navigation links). A Google search didn't yield any answers nor even any similar reports on this particular problem.
It's even more irksome in my particular case, since I have just implemented a stylesheet switcher in order to enhance certain accessibility aspects, but ironically this particular bug leads to a loss of accessibility.
Does anybody know what might be the reason (version 1.3.2.min related?, cookies related?, etc.) for this and how to solve it?
How can I disable my div?
Code:
I know you can make hidden/visible but don't know if you can disable it?
I find I cannot disable javascript in MSIE 6 I've Help'd, Google'd, and searched here to no avail.
<noscript>
You don't have javascript enabled
</noscript>
will not display for me.
I am trying to disable the F5 key in Mozilla. I have the next code in
javascript that it is working in Internet Explorer but it is not
working in Mozilla. how can I disable the F5 key in Mozilla?
<script>
document.onkeydown = function(){
if(window.event && window.event.keyCode == 116){
window.event.keyCode = 505;
}
if(window.event && window.event.keyCode == 505){
return false;
}
}
</script>
I have a div which includes many others tags (a, input, any others
links). How can I disable the whole div? I want to any of the included tags may
not be enable.
I have a perl cgi form that has a popup_list. Based on a value that
is coming in from a database query, I want to either
1) display the value (from the databse) and let the user change it;
OR
2) display the value (from the database), but NOT let the user change
it.
I tried using javascript to disable the popup list, and that works,
except the form "loses" the value of the entry in the popup list.
Maybe "disable" is not the correct property I want to use. If that is
the case, what is it?
What's the best way to display an image, disabling the user's ability to right-click on it?
I believe you have to use <body oncontextmenu="return false">. Would the
following work?
var x = "<head></head><body oncontextmenu="return false"><img src='temp.jpg' border=0></body>"
top.document.open()
top.document.write(x)
top.document.close()
Since this is a frameless site, I don't think this would work, at least
would never get to the close()...
I want to test/proof some <NOSCRIPT></NOSCRIPT> stuff in my page via PHP but can not figure how to disable JavaScript on my browser.
View 2 Replies View RelatedI have a table (created at runtime) that in same circumstances have some <td> empty.All <td> have this css:
[Code]...
Via firebug console (with a bookmark) I see that line 4 is executed but nothing happen. I have tried to add a style="display: none;" via firebug to these <td> and it works.
<div class="jcarousel-skin-ie7">
I'm trying to change disabled to true. It's not taking. And what I also don't get is what is disable doing for a div?
I have tried this:
I have a form with pairs of checkboxes. When one is checked then I want to enable the other checkbox for that pair, and disable when unchecked. I can get this to work when I have a separate function for each pair, but not if I try to use one function and pass the id of the element.[code]
View 2 Replies View RelatedI want to disable my text box using java script.Here "a" is the line number where change dynamically
var remarks="remarks"+a
var remarks_1=document.getElementById(remarks)
document.f_update.remarks_1.disabled== "true";
f_update is the form name.It is not working..