javascript

Convert css width string to regular number

While trying to compute the width of an hidden element I found that jquery.width() returns 0 for that elements' width. I found out that using jquery.css('width') would return the correct width by using the declared style width (even if that value is different from the initial stylesheet). The problem is that the css('width') method re...

How can I get Colorbox to appear in a div?

At the moment I've got Colorbox setup so that it starts automatically when the page loads, but I need to place it in a div on the page, instead of hovering in the center of the page. How can I do this? Thanks for reading. ...

Monitoring User Sessions to Prevent Editing Conflict

I'm working on something similar to a pastebin (yeah, it's that generic) but allowing for multiple user editing. The obvious problem is that of multiple users attempting to edit the same file. I'm thinking along the lines of locking down the file when one user is working on it (it's not the best solution, but I don't need anything too co...

Am i doing this iteration right in javascript?

Consider the two implementations below, data.addRows([ ['2004', 1000], ['2005', 1170], ['2006', 660], ['2007', 1030] ]); The above works (ie) it gets me what i want. and my implementation is, for (var i = 0; i < 10; i++) { data.addRows['row'+i,i]; } Is this a valid for loop or what am i doing wrong? I am usin...

show "share with friends" dialog with the new Facebook Javascript SDK

hi, is it possible to show a "share with friends" dialog with the new Facebook Javascript SDK? i'm using a frame-based application. in another app this feature looks something like this: ...

how to set border onMouseOver event of javascript

i want to set border of 1px solid lightblue color for a through javascript.. i hv written d follwng code.... function changeImage1(id){ document.getElementById(id).style.border="1px solid lightblue"; } bt its not working.... i m using IE to test this... help me out.... ...

Query objects with an array (without 3rd party script)

How can you query an object with an array? var myArray = ['A','C'] Using myArray, how can I get a returned array with ['1','3'] out of the following (previously JSON object) (without using a third party query script -- unless it's jQuery :) [ { "property1": "1", "property2": "A" }, { "property1": "2", "property2": "B...

Detecting the monitor resultion with javascript on a secondary monitor

I want to detect the monitor resolution with javascript. This works fine with screen.height and screen.width on the primary monitor. On a secondary monitor (extended desktop) this doesn't work! When I move the browser to the secondary monitor and call my javascript function with the resolution detection, screen.height and screen.width ha...

Extracting jpeg EXIF information using jQuery

I'm trying to extract EXIF information from images using jQuery. I've tried using a script I found here but I can't get it to read exif data from externally hosted image files. I've posted a simple example page here. The code is tiny so you can just view-source to see what I tried. Does anyone know either what I'm doing wrong or if the...

JQuery cookie extension will set a cookie with a path but will not read it

First, set a cookie: jQuery.cookie('monster', 'big', { path : '/sesame/'}); Next, try to read it: jQuery.cookie('monster'); Firefox tells me that the cookie has indeed been set. The value is big and the path is /sesame/. And yet when I tried to read the cookie it wouldn't work. Alternate version of the question: How do I specify t...

jquery 'regex' toggle

I have an id of the form id = MAIN. When a button is clicked, I want ALL other id's in the dom of the form (MAIN_*) where * is any string to be toggled, so: $(something).toggle(); // will toggle all id's MAIN_* How would I do this in the click event of my button? ...

dynamic CSS loading in IE won't work

Hi! I have a button in my page, and onclick event, if should append to the <head> a CSS file from a server and do something else. it works perfectly in FF but in IE, it seems not to work (it did append the <link> to the <head> - but the CSS won't affect the elements) Heres my current code: function loadDynamicCss(filename) { var filer...

Remembering Selections in ExtJS Grid with Paging On

I have the following example available: Ext.onReady(function(){ var myData = [ ['3m Co',71.72,0.02,0.03,'9/1 12:00am'], ['Alcoa Inc',29.01,0.42,1.47,'9/1 12:00am'], ['Altria Group Inc',83.81,0.28,0.34,'9/1 12:00am'], ['American Express Company',52.55,0.01,0.02,'9/1 12:00am'], ['American Inter...

javascript context menu click event/detection - filter paste content

Scenario: I'm trying to intercept paste events inside a textarea/input text, and filter the content being pasted. Webkit/IE are handled rather well, as I can attach code to the onpaste event, and then read from the clipboard what is being pasted. Plenty of examples around. Gecko is trickier, because as far as I know it isn't possible t...

jquery capturing text of selected id

If I have id's of the form: t_* where * could be any text, how do I capture the click event of these id's and be able to store the value of * into a variable for my use? ...

How can I inject a string of HTML into an element?

Using Mootools, we can inject an element into another element: $('childID').inject($('parentID'), 'top'); The second parameter allows me to control the location and can either be 'top' or 'bottom' to inject it into a parent object or 'before' or 'after' to inject it as a sibling. We can also set the HTML of an element from a string: ...

Jquery Validations when using Zend Framework

I am Using zend Framework-1.7.2. when I am Updating Account Information of logged in user that time I am using jquery validations. But the script is not working. How to use it? Please, anyone can help me ? I am not using Zend Jquery Plugin. I am using seperate Jquery script like we are including and using in any simple php project. ...

Dynamic select menu's in Rails?

Hi Everyone, I am trying to get dynamic select menu's working in my Rails application. I have a model called kase, a model called person and a model called company. When a user creates a new kase, they are presented with a select field to choose a Person and a select field to choose a Company. I am trying to make it dynamic, so if t...

Is it possible to get a list of workflows the document is attached to in Alfresco

Hello, I'm trying to get a list of workflows the document is attached to in an Alfresco webscript, but I am kind of stuck. My original problem is that I have a list of files, and the current user may have workflows assigned to him with these documents. So, now I want to create a webscript that will look in a folder, take all the docum...

unable to access html5 canvas?

I'm stumling upon a weird problem: The code just wont be able to access the canvas element. Consider this code: this.canvas = document.getElementById('canvas'); this.context2D = this.canvas.getContext('2d'); Firefox would produce an error say this.canvas is null. But if I write it like this: this.canvas = $('#canvas'); this.context2D...