javascript

Robust keyboard shortcut handling using JavaScript

What's the most robust way of creating a global keyboard shortcut handler for a Web application using JavaScript i.e. which event(s) should I handle and what should the event handler(s) be attached to? I want something like the system in Gmail which can handle both single keypress shortcuts and also shortcuts with modifier keys e.g. Ctr...

What does this line of javascript do?

While looking at the jslint code conventions I saw this line: total = subtotal + (+myInput.value); What is the purpose of the second '+'? ...

FireFox this Function...

Why does Firefox not handle this. This code works in IE. <%@ Language=VBScript %> <HTML> <HEAD> <META NAME="GENERATOR" Content="Microsoft Visual Studio 6.0"> </HEAD> <script type='text/javascript'> function drvFunc(elem) { var e = elem.name; var d = "document." var f = "frm"; var str = d+"."+f+"."+e+".value;"; ale...

How can I achieve a consistent layout in all browsers?

Hey, I'm near ending the repetitive alarms at my little learning project. It's still full of bugs, but as it is a weekend project I'm correcting them slowly. My problem is inconsistency of layout across browsers. At the moment, I'm trying to improve the "My Alarms" box after login (Just don't try to hack my website, it's still very u...

YUI Editor: Getting rid of <html> tags in content.

I implemented the YUI rich text editor and I would like to get rid of the <html>, <body> and DOCTYPE tags as soon as I save the content from the editor. I know I could do this afterwards by parsing the HTML, but there must be a better solution. Right now this is saved when I edit a text in the YUI editor: <!DOCTYPE html PUBLIC "-//W3C/...

Jquery question: How can I break up a multi-part form so that only one fieldset is visible at a time?

Hi! I have a firm grasp on XHTML & CSS, but PHP & Javascript look like magic to me. I'm building a discussion site using the PHP-based Textpattern CMS. When users are logged in, they can use a public-side form to add a new discussion topic. There are a lot of input fields, grouped by the HTML fieldset element within a single form elemen...

IE is not submitting; dynamically added form elements; is this an IE bug?

I wrote some Javascript to allow editing a list of items within an HTML form, including adding and removing items. Got it working in Firefox. When trying it in Internet Explorer, I found that any added items were not being submitted with the form. Long story short... lots of simplification, debugging, figured out what line is triggering...

What's the best way to get a list of the contents of a specific group of DOM elements in javascript?

The basic scenario: I've got a series of elements on an HTML page, generated dynamically. (Currently, they're all divs, but they don't need to be.) What I want is a javascript function that will loop though all of those divs (or whatever) looking for the presence of a specific value. What's the best, most cross-browser way to do this?...

Jquery autocomplete for input form, using Textpattern category list as a source

I'm using the Textpattern CMS to build a discussion site-- I have a firm grasp of XHTML and CSS, as well as Textpattern's template language, but PHP and Javascript are a bit beyond my cunning. On the input form to begin a new topic, users need to select a category from a list of over 5,000 options. Using the HTML select-type input eleme...

ASP.NET AJAX 3.5 and IE6?

I recently upgraded an ASP.NET app to .NET 3.5 and switched to the newer version of the ASP.NET AJAX library. In FireFox and IE7, everything works great, in IE6, anything that would perform a callback (Partial Refresh, or calling a PageMethod/WebMethod) throws an error: Object Doesn't support this property or method Line: 5175 Char: 9 ...

How do you call a Javascript function from an ASPX control event?

How do you call a Javascript function from an ASPX control event? Specifically, I want to call the function from the SelectedIndexChanged event of a DropDownList. ...

Does this JS Code work as expected?

Every 3 seconds I make an AJAX POST request to get the status of a process. This works great. When the process reaches 100% a call back function executes(indicated below) to add new elements to the page and then it cancels the setTimeout method that use to continuously get the progress every 3 seconds. However, I have been told by my u...

Sharepoint - How to remove link from Javascript form within List

We have a sharepoint Aspx form that is formatted like an excel spreadsheet. On each row of the form are links that when clicked, launch a script to show new links, allowing the user to add, view, or hide comments. This will appear for each line item clicked on. We would like to remove the "add comment" link from the script, but cannot...

How to capture the Ajax event that periodically refreshes the gmail inbox

I'm trying to write a Greasemonkey script that works with Gmail. I know how to create javascript that reacts to the user clicking on the Inbox link or the the Refresh link. My problem is that Gmail periodically refreshes the inbox with new conversations and I have no way of capturing this event. Is there any way to capture periodical ...

When I try to GZIP .js files using PHP I get some kind of php related error.

Okay, So I've googled a couple of pages and come up with the following solution: Add this in .htaccess #Active GZIP for php-files php_flag zlib.output_compression On php_value zlib.output_compression_level 5 and this for .js and .css: AddHandler application/x-httpd-php .css .js php_value auto_prepend_file /Library/WebServer/Documen...

Append dynamically generated dijit to end of a div

Is there a way to create and append a dijit to the end of a div? Say I have the following code: <div id="attendants"> </div> <button dojoType="dijit.form.Button" onClick="addPerson();">Add Person</button> I found the following code online but this replaces my 'attendants' div: var personCount = 0; function addPerson() { personCo...

jQuery Easing Plugin not overwriting default methods

I am trying to implement GSGD's Easing Plugin (1.3) for jQuery (1.3.2) and whilst the standard animate easing methods work the easing plugin features are no overwriting the standard slideUp, slideToggle etc ...

Move from sortable to sortable

Hey everyone, Is there any way for me to allow a user to drag a div which I've put in a sortable list (I used jquery ui's $.sortable() function), into a different sortable list? ...

seating plan

I have to build a theatre seating plan. Admin should be given an option to right click, add row, delete row, add numbering to seats, add seat to a row or delete seat from a rom (similar to excel rows and columns and cells). Admin can also click on each row to put specific price for that seat. What is the best approach to get it done? ...

innerHTML and C%23 (C#) in anchor hrefs - Firefox

If you set the innerHTML of a <div> to innerHTML = '<a href="Something/C%23">C#</a><br />'; What seems to actually get 'rendered' is: <div> <a href="Something/C#">C#</a><br /> </div> What is the proper way to escape this so the link will stay "Something/C%23" ? UPDATE: I noticed a weird little thing here. If you use a function to b...