javascript

Loop timer in javascript

Hi, I need to execute a piece of javascript code say, each 2000 milliseconds. setTimeout('moveItem()',2000) The above will execute a function after 2000 milliseconds, but won't execute it again. So inside my moveItem function I have: function moveItem() { jQuery(".stripTransmitter ul li a").trigger('click'); setInterval('mov...

Access MongoDB directly via JavaScript

Hi, is there any possibility to access and retrieve data from MongoDB directly over JavaScript form browser without backend processing? ...

assigning value to array in javascript

in php you could do like this: $key1 = 1; $key2 = 1; $array[$key1][$key2] = 'hi'; in javascript i tried with this: key1 = 1; key2 = 1; var array = new Array(); array[key1][key2] = 'hi'; but it didnt work. how can i do the same thing in javascript? ...

jQuery Menu Button Disappearing on drop down in webkit only, how do I make it stay put?

I have a problem involving jQuery drop downs. Basically the button which reveals the drop down dissapears upon revealing the drop down. Here is the code The HTML included in the navigation <div id="header"> <div id="navHolder"> <ul style="list-style: none;"> <li><a href="#" class="navBtn">Travel Blog</a></li> <...

jqgrid format column dynamically

I am trying to format a jqgrid which has some dynamic columns which I create like this JQGridColumn column1 = new JQGridColumn() { DataField = "ID", PrimaryKey = true }; ErrorsJQGrid.Columns.Add(column1); How do I format these columns to have a say 'yellow background color'? I can specify a in th...

XMLHttpRequest over SSL from Firefox extension

Hi there, I'm going to develop a firefox extension which makes an XMLHttpRequest to this WebService. I can query the service correctly with the following code (from the overlay.js): var req = "<soapenv:Envelope xmlns:soapenv=\"http://schemas.xmlsoap.org/soap/envelope/\" xmlns:dat=\"http://webservice.whereisnow.com/datatypes\"&gt;&lt;s...

ajax on javascript created elements

hi, is it possible that javascript doesnt apply to elements created trough an ajax request? practically i have a tree of elements like parents and children with a dept of more levels. i have the root elements on the index page and on click i can retrive the children trough this request: var get_children = function() { pid = $(this).a...

jquery issue (bug?) in IE with .css() manipulation

I have a block of jquery / javascript code that sets the left margin of an image depending on the browser width. I do some sums to calculate the required left margin and it goes in var $diff. This code works fine: $('#background-wrapper>img').attr('alt',$diff); which demonstrates that the sums are all working fine as the image ends ...

Transfer values from one selection box to another

I need to populate the first box with the items from a db table. Users would choose from the first box, and either drag value(items) to the second for selection, or would select items, and then click a button to move them over to the 2nd box. After that I need to update the db with the selected values/items. ...

javascript / selenium: get the window from the document object

I am writing user extensions to selenium. I have the document object. How can I get the window object of the window that contains my document? PageBot.prototype.locateElementByMyLocator= function(text, inDocument) { // I want the window here } ...

Best practices in using Javascript in ASP.NET in a pre-AJAX and pre-jQuery era

I would like to know what are the best practices in using Javascript in ASP.NET in a pre-AJAX and pre-jQuery era. What I meant by pre-era is not the time before AJAX/jQuery was created, but rather the time before it is popularized and widely adopted (by a significantly large number of programmers). i.e. Is it good thing to store the sc...

alternate to onchange event in <input type='file' />

Seems really a simple thing but can't figure it out. I've been using the onchange event on element and it works well. Once the user browses and selects a file, I get the path and upload it using a my custom js function. The problem is this doesn't work if a user selects the same file twice in a row, the onchange doesn't fire (which mak...

jQuery animation on multiple elements, single animation thread/timer or multiple?

Hi, I'm wondering when the jQuery selector returns multiple elements and I do a "slideDown" for example on all those element... $('.allthisclasss').slideDown(); Is there a single loop of code that moves all objects down in synch or if jQuery treats all objects separately and they each have a thread of execution to move themselves? My...

Is the DOCTYPE relevant only to the markup or also to the DOM?

Up to what level of abstraction does the <!DOCTYPE> declaration (and content-type) of a document remain relevant? For example, if I'm working with XHTML but want to use an element which is not available in XHTML - an easy example being an iframe - would it be bad practice to programatically add the element with JavaScript? Or do I eithe...

Merge multiple javascript functions into one

I have these two javascript functions and wish to "merge" them into one. I will be adding a few more of these converting functions later on and would like to keep it simple and cleaner than just duplicating the functions. <!--Convert kg in pnd--> <script type="text/javascript"> function init(){ document.getElementById('kg').onmouseup=fu...

URL Decoding JSON in C#

I have an app that uses ajax (jQuery) quite extensively and when sending JSON to my web service I always "escape" any strings to make sure there is not any nastiness in there. To decode it at the other end (in my c# code) I have been using HttpUtility.URLDecode() and this has been working a treat until it came to the £ symbol, it just do...

Display feet decimals in feet and inches (javascript)

Original question: this bit of javascript code will convert centimeters to feet. But the feet are displayed as decimals, I would like it to display as 5'10 instead of 5.83. SOLUTION: <script type="text/javascript"> function start(){ document.getElementById('hauteur_cm').onmouseup=function() { if(isNaN(this.value)) { alert('numbers o...

Javascript function in response to JQuery AJAX post fails in Rails...

I have finally got a JQuery lightbox solution to work in IE and with AJAX form posts with one exception. Here's what I'm trying to do: User clicks checkboxes to select users to send message to. (index.haml) User clicks submit, which triggers an AJAX post (invites_controller.rb) respond_to js opens a hidden div, generated from a partia...

javascript:find screen resolution when having multiple monitors

I am using this piece of code to determine the client screen resolution, and then logging it <input type="hidden" id="DFF63C7E-FB32-49AE-8ADA-3AB5C4834FB0" name="DFF63C7E-FB32-49AE-8ADA-3AB5C4834FB0"/> <input type="hidden" id="565C07CF-0D37-41DE-B47D-A247E9BD231B" name="565C07CF-0D37-41DE-B47D-A247E9BD231B" /> <script type="text/javasc...

Custom themes for the Netbeans IDE?

Looking for custom themes for the Netbeans IDE, especially dark ones! Thanks! ...