javascript

Creating accessible tooltips for a web site

Is there a best practice for making tooltip type functionality accessible to people with accessibility needs? I am interested in jquery tooltip and have found a few others but I am thinking twice before spending anytime as I am concerned about accessibility compliance of these. ...

Advice on creating a micro-framework in JavaScript

Hi, I'd like to know what are the steps required to create a framework on top of node.js. I believe this can be a good way to learn, that's why I'm doing this! I've been checking other micro-frameworks and bigger frameworks but I'm not being able to understand where to start. I'd like your advice on this. Thank you. Edit: MVC Framewor...

I need to have a licence facility on my web site

Hi I have a web site on my server that is used to plan events, authorised users log in and use the site. I am in the process of selling the facility to a client 'on licence' But he wants the code/script on his server. Can anyone suggest a suitable way to go about protecting my code even if it is running on somebody else's server ? any p...

Add properties to an anonymous JavaScript type after defined?

I know that in JavaScript you can add new properties to an existing type (like Date), but is it possible to add new properties to an anonymous type after it's been defined? For example, say I have the following script: var employee = { 'Name': 'Scott', 'Age': 32, 'JavaScriptNewbie': true }; Later on in my script I want to...

Problem with the innerHTML the content of a DIV

Hey guys, For some reason, I can't change the contents of a DIV in either IE or Firefox. Any ideas where I might be going wrong? JavaScript function displayTable() { document.getElementById('retailerDiv').innerHTML = '<a>HEY!</a>'; } HTML <input type="text" id="userQuery" onkeydown="displayTable()"/> <br/> <div id="retailerDiv"> ...

What is this practice called in javascript?

When you wrap your JavaScript in a function like this: (function(){ var field = ...; function doSomthing(){... ... })(); I noticed that this fixes scoping problems for me on a lot of web pages, but I've never actually known what this practice is called. ...

Controling The Location Of The "Confirm Navigation" Window with JavaScript

Often a user will misuse a Rich Internet Application, and attempt to use the browser's Back Button. Such mistakes can be disruptive to changed but unsaved information, as in a Flash or Flex application. It is a simple matter to alert the user for confirmation before leaving the page (see below). However, I have a client who strongly...

Help in jquery validation.

I am using JS fiddle for trying my hands on jquery validation. You can access the code at http://jsfiddle.net/8MmCS/3/ I am changing the background color of a control to 'red' if its validation fails. And if the data entered is validated, then the control border is changed to green. But I need to change the border color to green , only...

Strange behavior when applying Array.prototype.slice method to result of querySelectorAll

I'am trying to use jquery's selectors as custom Selenium locate strategy. Exactly as in this article http://johnjianfang.blogspot.com/2009/04/how-to-use-jquery-to-create-custom.html Unfortunatly when I use selenium.click('jquery=a.mylink') method nothing happens. But selenium.click('css=a.mylink') still works perfectly. I did a little...

Javascript relative URLs resolved differently depending on host

Hi, I'm getting a weird behaviour with javascript which I fail to understand: my application's javascript relative URLs are being resolved differently, depending on where the app is hosted: a) my computer's IIS 5.1 (Windows XP) or b) my host provider (which I'm almost sure runs Windows Server 2003). Behaviour 1 (the normal one?) - with...

How to enlarge a button as it receives focus?

I'm trying to make my button bigger when it receives focus: <html> <form name="myForm"> <button onfocus="width=200; height=200">myButton</button> <button>myOtherButton</button> </form> </html> Any idea how can I make it work? ...

How is the HTML5 cross-browser story going to be any different than CSS/JS?

When CSS and JS got popular, the big frustration was that every browser implemented it differently and only a limited set of "cool stuff" worked across browsers, or worked differently. Now we're making HTML5 popular, so it seems like we're about to embark on the CSS/JS incompatibility journey all over again, but now in a 3D, animated, a...

Problem with testing for checkbox being marked

I have an input array like <input id='delete[18]' name="delete[18]" value="1" type="checkbox"> <input id='delete[19]' name="delete[19]" value="1" type="checkbox"> This Javascript code for check does not work. Why? if (delete_question.19.checked == 1) { if (confirm('msg')) { return true; } else { return false; ...

Can I get help with this regular expression that should only contain a maximum of two (2) consecutive, repeat characters?

Here is the regular expression that I am trying to modify: The client only wants the user to be able to enter a maximum of 2 of the same consecutive characters. ^[a-zA-Z0-9-().\&\@\?\""#,\+\''\s\/]{7,}$ ...

How to call this in a function in a mootools class

I'm having problems implementing classes in mootools since I can't use 'this' when I send methods in say element.addEvent. Say I have this mootools class: var Dude = new Class({ highlightColor: '#f00', doStuff: function() { var parent = $('theParentId'); new Element('div', {'html': 'Click me'}) .i...

How to persist bookmarklet when loading new url?

Dear all, I'm not sure if this is possible~ Say a bookmarklet that creates an embedded iframe loaded with a web application and there's a few urls in the web application. When urls are clicked, they are loaded into the current browser window which is running the bookmarklet. By default, the bookmarklet will be "gone" after that. Is the...

bind method for single object OR array of objects?

How might I convert my bind method to allow for both a single object or an array of objects (in this case several links) to have functions bound to certain events? Would be cool to handle it within the bind() method I think.. Any assistance would be appreciated var dQuery = function() { return { bind: function(obj, type, handler, de...

Escaping JavaScript[/CSS] between <script>[/<style>] tags: Insights on a potentially broken status quo

I'm a webdeveloper with an emphasis on server-side programming. What little I've tinkered with JavaScript, I've done with externally referenced files or event handlers, and the barest minimum of an initialising function call between <script> tags. As such it came as a surprise to me about a week ago that the data between <script> tags i...

How to make a Xul button bigger using css as it get focus?

I saw at this page that I can use CSS to change my button as it get focused. But trying with the following code in the CSS didn't work: button:focus { style.width='200px'; } Any idea why it isn't working? ...

How does JavaScript interpret indexing?

function highlightRow(searchRow) { if(searchRow != null) { var oRows = document.getElementById('Table').getElementsByTagName('tr'); //use row number to highlight the correct HTML row. var lastTwo = searchRow; lastTwo = lastTwo.slice(-2); //extract last two digits ...