javascript

Keyboard Events for Modifier Keys in Safari 2.0

Hello, I'm using keyboard events ('keydown' and 'keyup') to detect exactly when the user presses or releases the shift key. In Safari 3+, this works fine. However, Safari 2.0 doesn't seem to fire keyboard events for the shift key—in fact, it doesn't seem to fire events for any of the modifier keys... Does anyone know how I might deal ...

How do you access a custom XHTML attribute with JavaScript?

I have the following XHTML: <span id="myid" cus:att="myvalue" xmlns:cus="http://mycompany.com/customnamespace"&gt; </span> Is it possible to access custom attributes with javascript? I have the element that represents the span. Doing myElement.att doesn't work, and I can't figure out how to specify the namespace? ...

Why is my TinyMCE hidden textarea acting up?

I have about 7 textareas on a web page, all of them are rich text editors using TinyMCE. However at page load only 1 of them is visible and the rest of them hidden. The user can click a 'show' link which would display the remaining textareas one by one. However, I have a weird problem. All the textareas are setup like this: <textarea c...

jQuery click(fn) won't work with input element

I want to use jQuery to detect clicks on a bunch of radio buttons. They have all been assigned a css class, foobar, to detect them. Easy, right? Still, this code doesn't work: $("input.foobar").click(function () { alert(this.id); } ); What wrong with the code above? Does this.id really return the id of the current radio button? ...

Help with jQuery UI dialog

Hi, I am using jQuery UI.Dialog. I'm having a small problem, when I click the link to show dialog box the text from #Test disappears and the modal overlay is shown but the actual modal box is not displayed. Using FireBug the dialog box is created but has Display:None so is not shown. Also, if I change this in firebug to Display:Block...

Optimize jQuery code

I've written this jQuery code that fades in a overlay with some links over an image. What i found out is that it is painfully slow when I add like 10 of these images. I would really appreciate some tips and tricks on how to make this code faster. If you have some tips for my HTML and CSS that would be great too ;) jQuery code $(docume...

What is the best way to develop a widget from a RSS feed ?

What is the best way to develop a widget from a RSS feed which renders uniformly across all websites and browsers which can be embedded easily on other websites without facing any problem? i have tried below approaches but each of them has their own problems Using Javascript: when embedding such widgets into other websites the style...

FlexiGrid - set width of Grid in code

Hey, I'm trying out Flexigrid (http://code.google.com/p/flexigrid/) for a new app - I'm really impressed with it but I can't find a way to set the width in code. The main reason for this is to get the GRID (not the columns inside the grid) to align fully to the size of the window. I know, it makes a mockery of the horizontal resizer,...

Executing javascript code upon the load (and inside) of a javascript Modalbox

Hi, What i'm exactly trying to do is make my script.aculo.us Autocompleter work for my form when it is loaded inside a Modalbox object. Of course, i've tried my Autocompleter when loading the form as standalone and it works just as expected. For reference, here is my JS code loading the feature: Event.observe(window, 'load', function...

Keeping caret position in a visible position in text input - firefox misbehaves

I'm toying with the idea for my text input box of clicking on a div containing a selection of "tags" to add meta content. My text input has a width of 35, but I want it to be able to overflow. I've searched and found methods to focus and position my caret at the end of the updated input content, and chrome and IE behave themselves and a...

borrowing costructors and prototype chain

Hi, in many books and online tutorial there are examples on passing data to a super-class constructor via a borrowing method pattern: var Parent = function(name) { this.name = name; this.my_parent = "parent_property"; this.go = function() { alert("GO") } } var Child = function(name) { this.name = ...

windows command line javascript

I'm trying to run javascript from a windows command line via script cscript //NoLogo test.js However, I can't find any predefined objects which are available. I'm totally at a loss - Can't get hello world to work: System.print("Hello, World!") results in "System" is undefined Is there another way I should be running this - like thr...

Detecting Login Fields

Would there be any way to detect login fields on ANY website using javascript? IE and Firefox have the ability to 'remember' my username and password. I would like to create a script that replicated that functionality. So for example, when presenting the login page for GMail, how could I 'find' the username and password field and get...

Reference parent window document

Hi there, I'm trying to access the parent window document from a popup. <script type='text/javascript'> $(document).ready(function(){ var summary = window.parent.document.getElementById('summary'); var content = summary.innerHTML; }); </script> Is it even possible? Is there a jQuery specific way to do it? Thanks ...

Is there a way to define symbolic constants in Javascript ?

I searched if JavaScript offers a mean to define symbolic constants, but didn't find anything. Did I miss something ? Is it a common practices to use const var instead ? var const MAXIMUM_VALUE = 100; Thanx. ...

Google analytics, why have two script blocks?

Why does the Google Analytics script I add to my webpage need to come in two script blocks? <script type="text/javascript"> var gaJsHost = (("https:" == document.location.protocol) ? "https://ssl." : "http://www."); document.write(unescape("%3Cscript src='" + gaJsHost + "google-analytics.com/ga.js' type='text/javascript'%3E%3C/s...

ASP.NET MVC Ajax.ActionLink

Hi, When i click on a Ajax.ActionLink, which displays a partial view, why does none of the javascritp associated with the partial view fire? This previously all worked before when I used Html.ActionLink. I have a series of scripts referenced in master page, which include $document.Ready functions. I have also tried added the script i...

Removing items from data bound array

How do I remove an items from a data bound array? My code follows. for(var i = 0; i < listBox.selectedIndices.length; i++) { var toRemove = listFiles.selectedIndices[i]; dataArray.splice(toRemove, 1); } Thanks in advance! Edit Here is my swf. The Add Photos works except when you remove items. http://www.3rdshooter.com/Content/Fla...

Having trouble with Lightbox

OK i downloaded all the files and put them into a directory on m server call "lightbox" when I try to use it on a page, the image pops up on the bottom of the page, not overlapping modal like. I changed the images sources in the lightbox.js file to include the lightbox/ directory. The images in the css file are still relative to the css ...

How to add a div dynamically by using Dojo?

I have a the following static div: <body> <div id="div1"></div> .... I want to add a div with id "div1_1" within div1 dynamically by using dojo. How can I do it? ...