I have tried to get an event listener to listen for when the user presses Control-D on their keyboard. This would trigger a confirm delete function - if you've ever used QuickBooks Ctrl-D is the command that does this and this is a financial application.
Problem is that in FireFox, Ctrl-D means bookmark the page and this window pops up. I want to "return false" before this happens.
On this subject I would also like to take over Ctrl-C and Ctrl-V eventually but with Ctrl-D it will work for anything. here is what I have. Again, IT WORKS, but doesn't stop the natural event (bookmark page) fromhappening:
Code:
function AddOnkeypressCommand(strCommand){
//---- version 1.0, by , last edit 2004-12-14
//add to array of commands:
m_onkeypressCmds[m_onkeypressCmds.length] = strCommand;
How can I subclass a native class to get my own class with all the function of the native clas, plus correct instanceof behaviour?
The scenario I'm thinking of is something like
function MyArray() { Array.apply( this, arguments ); } MyArray.prototype = new Array(); MyArray.prototype.constructor = MyArray;
var marr = new MyArray(); marr[0] = "abc"; marr.length == 1; // true marr instanceof MyArray; // true
But this seems impossible due to the Array constructor returning a new object even when called with my own "this" in the apply() above. Can this be solved in any way?
I'd like to announce release 1.0.7 of JNEXT (JavaScript Native Extensions). JNEXT is an open source framework for securely accessing the full range of native OS resources (files, databases, sockets etc.) by using JavaScript from within a Web Page. It is light weight, cross platform, cross browser and designed with simplicity in mind....
Am I the only person who finds wildly wrong the jQuery behavior of handler invocation for native events on state-changing elements like check boxes and radio boxes?Specifically, when the user clicks a check box or a radio box, the state of the element is changed and then the handler is invoked.However, when I call"click()" on the elements, the handler is invoked *before* the element value is updated. That makes it pointlessly difficult to write handler routines that need to look at the value to know what to do.
I could have sworn I saw a command that allows Javascripts to use the browser's native base64 encode/decode but I must be Googling for the wrong terms. Do most browsers expose these converters to javascripts's there a way to use these converters?
I was wondering if there are any sites dedicated to ending javascript objects using the prototype property to give them features like trimming string, removing elements of arrays by name, removing duplicates in arrays, etc. Granted I have functions to do this but there's probably a ton of other good ones out there. Most things I've seen are frameworks like JQuery (which is awesome) but it doesn't extend these objects.
There's no native linked list implementation in JS. I'm wondering if it would be worth it to implement one.
I'm using a lot of insertions and deletions with arrays of around length 5. How fast are insertions and deletions in JS native arrays compared to an optimized (but not native) linked list implementation in this situation? How about arrays of length 10?
I have a series of links in my page, all with its title atribute filled. The thing is that I don't want the browser to show this title whenever i hover those links, but still want to have mi titles in the markup Is there any way to do it?
I have a few String prototypes such as String.prototype.EscapeReg = function () { return this.replace(/[-[]{}()*+?.,\^$|#s]/g, "\$&"); }; // Escapes characters for use with a regular expressionI also have my own class/ library which is used like this var adg = new AndyG_ns.ADG_Utils(); adg.StartClock('AndyClock','dd mmm yy hh:nn'); // etc.What I would like to do is to only add the prototype to my library (not to the global namespace). The end result I'm looking for is to use code such as:
var adg = new AndyG_ns.ADG_Utils(); var myString = new adg.AString(); var parsed = myString.EscapeReg();
In addition, I want to be able to also use/create my special string sub-class within my library. I suppose I'm saying that I would like to extend or super-class the native String object.
I use Google Chrome because of the Javascript debugger that comes included and I keep getting the following errors with my AJAX script
Code:
Uncaught TypeError: Cannot call method 'getElementsByTagName' of null option.html:23 Uncaught TypeError: Cannot call method 'getElementsByTagName' of null option.html:40
[Code]....
What is supposed to happen is I press either button then it calls either getoptions1() or getoptions2() which then lists the options using listoption() Then the user selects a color and setoption() gets called. I'm having a problem with either getoption function or the listoption function.
I've boiled down my code to the essence of the problem; a variable which serves as a parameter to a function keeps coming up as 'undefined'. The code is quite simple:
In my website i am planning to do portfolio things in that i gave fade in fade for all images this is working with same size of image.But i have images like this sizes 500/300, 300/150 like if i give this images into portfolio that time if one image fading to another one means that time small size imGE is going top or bottom like that ,I alighed as center.
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head>
I have a single page with a single form, but I have split the form into 3 divs for styling purposes. I have some java script that is supposed to pull values from the text fields, and put them in a selct box using 'document.forms[0].name.value', but nothing is happening. I am wondering if having the form split into to divs is causing the JS to not be able to find the fields, using the forms array? Here is the form portion of the html code:
I am using the following code for disabling Ctrl-N in IE7. It disables the Ctrl-N feature of IE which opens a new window containing the same page as the 'active' window. The code works great (at first glance). However, I noticed that, if you click anywhere inside the browser window and THEN press Ctrl-N, the new window will open. If you don't click anywhere inside the window, the following code works. Can anyone see an improvement to the following code so that clicking inside the browser window doesn't bypass the javascript?
I accidentally damaged my slide show today and cant work out how to fix it. If you go to [URL] its on the home page. I had only links showing so I added the <ul id="slideshow"> tag and now I have the box coming up but its just blank.
I am having some issues running some ads coming from a database not showing up on my page it doesnt show anything at all im not sure what i have done wrong?i cud have it statically written in but it would be easier if i did it that way of getting the urls stored in a database.this is my php code along with javascript code inside my php code.
PHP Code: include("dbconnect.php"); $rQ="SELECT * FROM banner";