javascript

Getting elements using Javascript

I have a bunch of input elements that have a particular substring in their IDs. Using javascript, is there a way to get these elements as an array? I wouldn't know the full ID - only the substring. Is this any simpler if I use JQuery? ...

Does visibility affect DOM manipulation performance?

IE7/Windows XP I have a third party component in my page that does a lot of DOM manipulation to adjust itself each time the browser window is resized. Unfortunately I have little control of what it does internally and I have optimized everything else (such as callbacks and event handlers) as much as I can. I can't take the component of...

Technique to dynamically set mutiple checkboxes, mixing javascrpt and php forms

New to javascript, my problem is effectively: I have a php page that produces a single form with multiple process blocks or sections each with a group of checkboxes eg <form action='./this.php' method='POST'> One<br> <input type='checkbox' name='one[part1]'>a<br> <input type='checkbox' name='one[part2]'>b<br> <input type='checkbox' nam...

Binary Search for a line in a text file using Javascript

Is there a way to do a disk-based binary search for a particular key in a text file in Javascript? The text file is too big to be loaded into memory, but sorted by the key values. In particular I am looking for a way to mimic Perl's Search::Dict functionality in Javascript. For e.g. If I have a file foo.txt: a 1 b 10 c 5 z 4 look(c,f...

HTML CSS: Iframes/Dynamic Problem

I am having some trouble creating a experimental 'dynamic' style website. The site is set up as follows. The user has a menu of links to choose from, specifically using an image map. When they hover over a selection, an iframe pops up (becomes visible) displaying some data. When the user removes the mouse the iframe goes away, until t...

how to add text to opewnwyswig editor by java script code outside openwyswig

I've got page to edit some html code from db, to do that i use openwyswig http://www.openwebware.com/wysiwyg/demo.shtml which hosts over textarea, functions implemented in editor to insert images and hyperlinks aren't quite suitable for me, so i need to find some piece of code which help me to change/insert text to that area from outside...

Does javascript cache DOM elements?

I'm using mootools to toggle the display (and existence) of two DOM elements in one of my forms. Then, I am using javascript to validate the form to make sure that all of the required fields were filled in. The problem is that the the browser seems to be caching the elements. For example, I have html like this: <input name="inputbox"...

Generate a comma delimited string from items in a HTML List Box (multiple select) with Javascript

So if you have a html List Box, also called a multiple select, and you want to generate a comma delimited string that lists all the values in that List Box you can you can do that with the following example. The list_to_string() js function is the only important thing here. You can play with this page at http://josh.gourneau.com/sandbox...

Visual Studio Project Template for JavaScript/VBScript?

Has anyone had luck finding a Visual Studio Project Template for JavaScript and/or VBScript? I would like to use VS as my script IDE but get frustrating with the lack of integration. I'm hoping someone else was just as frustrated as me and already came up with a solution. ...

How to link another page when time runs out

I try to develop online exam app with JSP.So I want to link result page with parameters of existing page(exam page) when time runs out. I want to know how to add timer and link another page when time is up. ...

How to catch exceptions in javascript?

I want to catch exceptions in javascript if an insertion query is not done. I have written the code below: var adoConn = new ActiveXObject("ADODB.Connection"); var adoRS = new ActiveXObject("ADODB.Recordset"); var rec = new ActiveXObject("ADODB.Record"); adoConn.Open="DRIVER={MySQL ODBC 3.51 Driver};SERVER=172.25.37.145;" + "DATABASE=c...

Is there a limit to the number of Javascript objects you can have on the go at any one time?

I'm looking into converting a flash app I have into Javascript but was told that it probably wouldn't be possible due to the number of objects I would have to have on the go. Can anyone tell me if this is true and, if it is, what the limits are? TIA, Urf ...

Does the ClientScriptmanager work when called in a partial postback?

I would like to close the browser window when an ASP.NET operation has succeeded. The code below is triggered by a button that resides in an Ajax UpdatePanel. Page.ClientScript.RegisterClientScriptBlock(typeof(LeaveApproval), "ShowSuccess", "<script language=javascript>window.opener=self; self.close();</script>"); However, this code d...

JavaScript drag and drop photo resizer cropper

I have an image of arbitrary size on the page. As an output I need an image of a fixed size, say 90x120px. I would like the user to chose the area of the image by drag-and-dropping the big image behind the 90x120px 'window'. The window would specify the resulting image. Something like this is implemented at facebook image upload. I know...

Floating point number in JS

I'm writing a small webpage that will enable students to answer questions and get feedback on their answers. Part of this detection checks for common errors to give them guidance. Specifically I want to check if their answer is a power of ten out from the actual answer. If the answer was 3.93E-6, this condition should activate if they ...

Ajax onSuccess callback while not having any control over ajax calls

I have a simple JS function that needs to get called when AJAX call succeeds, however i don't have any control over the AJAX calls since the framework (DNN5) handles all that. How do i call my function on AJAX success? I use DNN5 and jQuery, if you're not familiar with DNN, just assume that all the controls on the page are wrapped in t...

How to catch event after default action was performed in JavaScript

Hi all, I have read in the article (the article) following concepts about event handlers: For a non-bubbling event, the sequence of the dispatch is like this: Capturing phase: All "capturing" event handlers are fired on all ancestor elements, from the top down. The event is fired on the target element, which mean...

Windows Scripting: VBScript, DOS, JS, Python, ...

Say you were mainly a C-syntax like programmer and Linux systems administrator, and you were tasked with creating some simple automation tasks on Windows (monitoring of back-up files, process monitoring, ...). Which language would you prefer to write your scripts in? There's a large collection of VBS-scripts out there (using VB syntax), ...

Using jQuery, how can I store the result of a call to the $.ajax function, to be re-used?

Thanks for reading this. I imagine this is really a javascript question, and my title probably does not get at the heart of what I am trying to do, but I want to store the result of my ajax request in a global variable. This would allow me to test the var before making the ajax call...and avoid repeated ajax calls for the same data. I n...

Automatic image upload and display in a form

How to make the browser upload and display image after the user puts it in the file upload widget? I've got a form where an image should be uploaded and edited by the user on the fly (before they hit submit). Can I do it with Jquery? ...