javascript

What is a good solution for cross browser javascript redirect with history?

I am currently fighting Google Chrome on the following action: location.href = url location.replace(url) document.location = url window.navigate(url) // doesn't work in Chrome/Firefox location.assign(url) window.open(url, '_self') window.location.href = url I have tried all, and neither will add a history ent...

Use jQuery/JS to determine the DAY OF WEEK

Is there a method using either JavaScript or jQuery to determine what day of the week it is? For instance, if the date a user picks in the box is a Sunday, I can alert them. Thanks ...

Microsoft certification and alternative paths

I work in an environment where the microsoft certifications are quite highly regarded - and I'm studying for some of them. I do a lot of non-microsoft javascript/ajax work and this is got me thinking about what are the alternative options if you are not a microsoft person. There is no recognised javascript certification or (I'm guessing)...

Javascript var hoisting issue

I have a very simple Javascript function that hits a MS SQL server and returns some records back. There is a cell that i want to only display in the top table row when it is unique. I believe my problem is var hoisting because the variable that i assign within the while loop does not work because the value is not carried from the last r...

Audio clip recorder for website.

Hello, On the client side of my website i want to be able to allow the user to record a short audio clip, around 20 seconds duration and store this recorded audio on the server. Is there any way to do this using any client side technologies like javascript or flash ? Thank You. ...

calling setTimeout again stops first instance

I have a trivial little game I wrote in javascript that creates a wave from where you click. I figured out two ways to make the "wave" move across the screen: by calling jQuery.animate() with increasingly large times. demo by recursvely calling setTimeout. demo The problem I have is that I want the behavior of 2 (columns all grow at...

Visually Optimizing JavaScript Conditional Operators that are stringed together

In JavaScript let's say we have the following code var test = 'd'; if (test != 'a' && test != 'b' && test != 'c') alert('were good to go'); This if seems rather lengthy to me. I would love to write something like if (test != ('a' && 'b' && 'c') alert('were good to go'); Sadly this doesn't work. What is a more elegant way to w...

jQuery animate problems

I use the following snippet to make an element's background lightblue, then slowly fade to whiite over 30 seconds: $("#" + post.Id).css("background-color", "lightblue") .animate({ backgroundColor: "white" }, 30000); Two questions. First, instead of fading to white, is there a way to fade opacity to 100%? That way I don't have to cha...

Microsoft Script Editor for IE6 on XP Home SP3 ?

Hi all, My understanding is that Microsoft Script Editor is the best debugging utility for IE. To enable debugging in IE6 on XP, I found these instructions: On Windows XP SP2+, the option has been split to two: Go to Tools->Internet Options…->Advanced->Disable Script Debugging (Internet Explorer) Go to Tools->...

Getting the value from cookie and storing in the database

Hi, I want to store the search url as a cookie in client side and write this url back to the database.The code below is not showing any errors but it is not writing the url string in database.I tested individually with writing url in database it works fine.Just its not working when i was trying to do from cookie.So please give me if you...

Extending a DOM element with jQuery

I'd like to extend a DOM element without extending all of them. That is, I'd like a custom class with its own methods and properties, but also be able to treat it as a div. E.g. MyClass function(){ this.foo = "waaa"; } MyClass.prototype.changeText = function(newtext){ // if this extended $(document.createElement("div") someth...

SharePoint - Open Document Library PDF in New Window

I want PDF files in MOSS 2007 Publishing site document libraries to open in a new window. Is it possible to achieve this by creating a custom HttpHandler? I don't want to mess with a site definition for something as basic as this... ...

JavaScript scrollTo method does nothing?

Hey all.. So I am desperatley trying to get some scrolling functionality to work on a page. After not having a luck I decide to just stick window.scrollTo(0, 800); on my page to see if I could get any scrolling to happen. Nothing does happen. I have an accordion that expands and then I want to scroll to a specific element with in it. Bu...

Javascript regex to detected possible credit card numbers

I'm having no end of trouble coming up with an appropriate regex or set of regex's. What I want to do is detect: Detect contineous run of digits of length 13 through 19 Detect contineous run of digits interspersed with whitespace of length 13 through 19 Detect contineous run of digits interspersed with dashes of length 13 through 19 ...

jquery script is using to much memory

I have the code below on a social network site, it loads a file that shows users new notification messages if they exist. Problem is when I leave the page open for a while, it eventually consumes too much memory on my PC and starts to make firefox non-responsive and throws an error message saying that memory is getting low and asking if...

Can Javascript detect the manual appending of an anchor to the current location?

Say I've loaded some arbitrary HTML page into my browser. Then into the address bar I append "#anchor-name" and hit enter. Since I only added an anchor and didn't call a different page, the browser does not make another call to the server. So there is no onLoad event, etc. Nonetheless, could some Javascript on the page detect this acti...

How well does JavaScript scale?

I was working on this carousel thing, using the iCarousel. It works pretty nicely with a few images, using MooTools. However when I added 70 pictures (around 30k each) it stopped working so nicely. Having spent some time poking around in the code of iCarousel it looked pretty decent and stable. So this got me thinking: is the problem inh...

any good comparison for javascript vs. other OO languages?

I've just started learning javascript and noticing its attributes relating to other OO languages (weakly typed like php/tcl, has error handling and inheritance like java's model). When I was learning java there were several "C++ vs. Java" comparisons that really helped me wrap my head around the philosophy of the language. Javascript do...

Javascript setTimout within an object/function help

I'm new to closures and have a 'gets me by doing most things' understanding of javascript and so am wondering how I can improve etc on the following which was me trying to have an object that has a counter in it...trying to improve/further my understanding. edit: the following code works, sure...but likely it is wrong (is it?)...I don't...

Get the width of a DOM element?

Is there a way of accessing the width of a DOM element? In particular, I'm looking to get the width of a table cell (td) who's width can be of varying lengths based on the length of the text in that cell. ideally, the solution I'm looking for will use the jQuery library, but others will work as well. Also, I must stress that the solut...