javascript

In JavaScript, are regular expressions evaluated in compiled code?

When a regular expression is run JavaScript, is the regex engine that evaluates the expression compiled code? or the engine itself is written in javascript? While doing some basic string matches tests, I found that a single regex is considerably faster than my JavaScript function that does the same thing, so I wondered why the regular e...

Hide a datagrid column with Javascript?

I have a .net datagrid with some 20 columns. I need a column's visibilty to be toggled based on the click of a button using javascript. Any ideas? ...

I want to parse a PAC file to get some Proxy information... just not in Explorer

Follow on from this question: I am working on a Python 2.4 app which will run on Windows XP. It needs to be able to download various resources from HTTP and it's got to work in all of our office locations which use "PAC" files to automatically select http proxies. Thanks to somebody who responded to my previous question I managed to fi...

JavaScript equivalent of PHP's strpbrk function?

Hi, In PHP, I can use the strpbrk function to determine if a certain string contains a certain set of characters. Is there a way to do that in JavaScript? TIA. Edit: for those who may know JS but not PHP, strpbrk takes an input string and a string containing what you want to match as its arguments, and returns a string starting from ...

Javascript Event Synchronization

I'm building a concert calendar that's very heavy on javascript (using jQuery). I'm having trouble synchronizing various events throughout the app, and I'm looking for suggestions for how to do this. An example of a simple use case: User clicks a month Calendar skips to that month An example of a more complex use case: User selec...

How to get height of the highest children element in javascript/jQuery?

Hi, I need a function to get the height of the highest element inside a div. I have an element with many others inside (dynamically generated), and when I ask for the height of the container element using $(elem).height(), I get a smaller height than some of the contents inside it. Some of the elements inside are images that are bigge...

Menu bar not displayed on window.open for Mozilla Firefox

When I run the JavaScript code below in Mozilla Firefox, the menu bar does not show: window.open(location.pathname + "?print=print", "print-window", "toolbar=yes,location=no,scrollbars=yes,menubar=yes"); What is going wrong here? Note that I'm opening the same file (in another w...

CSS and JavaScript Conditionally Repositioning onScroll an Absolutely Positioned DIV

We have a client who desires some extremely long pages. Say 4000px plus. They would like to have a back to top element that appears at 1200px from top in the nav column and then continues to reposition as you scroll to say 200 from top. This sounds to me like something CSS cannot, at present, do especially if IE 6 needs to be accommod...

How to find 3rd part of location pathname?

I want to get 'second' in the following sample web address. http://www.mywebsite.com/first/sedond/third.html "first" can be any length. i.e. contact, images etc If I use document.location.pathname, I get "/first/sedond/third.html". If I use document.location.pathname[1], I get "f". How can I get "first" part by using document.locati...

Am I using the PHP.js strpbrk function properly?

Hi, I have the following JS function: function validatePass() { var oldPass = document.getElementById("oldpass").value; var newPass1 = document.getElementById("newpass1").value; var newPass2 = document.getElementById("newpass2").value; if(strpbrk(newPass1,"abcdefghijklmnopqrstuvwxyz") != false) { document.getElementById("Contain...

Open an HttpURLConnection in a browser

I am working on a jsp page which uses a bean to create an OAuth authenticated HttpURLConnection and am able to connect successfully. Is there anyway that I can take that open HttpURLConnection and somehow display the contents in a browser window? ...

JQuery UI disabling reorder in sortable lists

So I have two sortable lists in a web app I'm writing. What I want to do is make one of the lists not be reorder-able, but allow it's items to be dragged onto the other list. Items from list one can be dropped on list two, but items on list one can't be rearranged. Another thing I want to do is to make it so when items are dragged off o...

ajaxFileUpload & document.domain

Hi, Does anyone know why ajaxFileUpload callback (succes) is not working on a page which use document.domain ? I'm using document.domain in order to proceed to main/sub domain AJAX request. UPDATE iframe on main domain : <iframe style="display:none;" src="sub.main.com" width="0" height="0"></iframe> <div id="stuff"></div> <script ...

shouldStartLoadWithRequest is not called in my iPhone App

I have a view controller with a UIWebView controller. I'm trying to get the javascript inside the html content of the web view to pass some information to my objective c code. I came across a number of examples online that set window.location in a javascript function and then catch the event generated by setting the view controller to be...

javascript array associative AND indexed?

can an array in JS be associative AND indexed? I'd like to be able to lookup an item in the array by its position or a key value.. possible? ...

Setting a cookie value to a incrementing int

Is there a integer element for a cookie? I need the cookie to increment by 10 everytime a certain button is pushed. How can I start the cookie at 0 the first time and it's next value is based on it's current state. document.cookie += 10; gives 10, then 1010, then 101010. Right I dea but I need integer values- Need 10, 20, 30, etc... ...

Favorite JavaScript Unit Testing Framework

I've really only implemented my own simple code for creating and running simple unit tests in JavaScript. Basically it automatically executes a list of functions and if a function throws an exception it fails, if not it passes. I'm trying to find a good JavaScript Unit Testing Framework to use with my projects going forward, but there a...

Initiate POST Request, Perform Action, Then Complete Post request - how?

When a user clicks a submit button I want the form to be submitted. However, just before this happens, I want a window to pop open and for them to fill in some data. Once they do this and they close that child window, I want the POST request to be made. Is this possible, if so how? I just need help after the window closes, how can I mak...

Refresh image with a new one at the same url

I am accessing a link on my site that will provide a new image each time it is accessed. The issue I am running into is that if i try to load the image in the back ground and then update the one on the page I only get the same image. If i refresh the entire page then the image is updated. var newImage = new Image(); newImage.src = "ht...

Javascript getters/setters in IE?

For whatever reason, Javascript getters/setters for custom objects seem to work with any browser but IE. Does IE have any other non-standard mechanism for this? (As with many other features) If not, are there any workarounds to achieve the same functionality? ...