javascript

What's the difference between JavaScript and JScript?

I have always wondered what the heck is the difference between JScript and JavaScript. ...

How does any application (chrome, flash, etc) get a time resolution better then the system time resolution?

This article on microsoft's tech net site supplies an exe that will calculate your windows machine's minimum time resolution - this should be the smallest "tick" available to any application on that machine: [http://technet.microsoft.com/en-us/sysinternals/bb897568.aspx][1] The result of running this app on my current box is 15.625 ms....

How do I check to see if an object has an attribute in Javascript?

So: x = {'key': 1}; if x.hasOwnProperty('key') { //do this } Is that the best way to do that? ...

What is the best way to get a cookie by name in JavaScript?

I am using prototype and I can't find any built in extensions to set or retrieve cookies. After googling for a little bit, I see a few different ways to go about it. I was wondering what you think is the best approach for getting a cookie in JavaScript? ...

Zooming an element and its contents-- an alternative to CSS3's zoom property?

Is there a cross-browser method to emulate CSS3's zoom property? I know how to zoom images and text separately, but cannot seem to keep everything aligned. One solution might be to read the computed styles of the element and its children, convert all measures to px, multiply them by some factor, and then generate HTML/CSS with these ne...

Comet and jQuery

I've done some research into server push with javascript and have found the general consensus to be that what I'm looking for lies in the "Comet" design pattern. Are there any good implementations of this pattern built on top of jQuery? If not, are there any good implementations of this pattern at all? And regardless of the answer to tho...

Trying to set/get a JavaScript variable in an ActiveX WebBrowser from C#

We have a windows application that contains an ActiveX WebBrowser control. As part of the regular operation of this application modifications are made to the pages that are displayed by the ActiveX WebBrowser control. Part of these modifications involve setting a JavaScript variable in a web page being loaded into the ActiveX WebBrowser....

How do I, with JavaScript, change the URL in the browser without loading the new page?

How would I have a JavaScript action that may have some effects on the current page but would also change the URL in the browser so if the user hits reload or bookmark the new URL is used? It would also be nice if the back button would reload the original URL. EDIT: As moonshadow correctly assumes I am trying to record JavaScript state...

Copy&paste from Office 2007 into <textarea>

I want to copy and paste text from a Office 2007 document (docx) into a textarea. On Window, using Firefox 3, there is additional jiberish that gets put into the field: ...Normal 0 false false false EN-US X-NONE X-NONE MicrosoftInternetExplorer4 Normal 0 false false false EN-US X-NONE X-NONE MicrosoftInternetExplorer4 Normal 0 false ...

How do I programatically force an onchange event on an input?

How do I programatically force an onchange event on an input? I've tried something like this: var code = ele.getAttribute('onchange'); eval(code); But my end goal is to fire any listener functions, and that doesn't seem to work. Neither does just updating the 'value' attribute. ...

How to disable Javascript in mshtml.HTMLDocument (.NET)

I've got a code like this : Dim Document As New mshtml.HTMLDocument Dim iDoc As mshtml.IHTMLDocument2 = CType(Document, mshtml.IHTMLDocument2) iDoc.write(html) iDoc.close() However when I load an HTML like this it executes all Javascripts in it as well as doing request to some resources from "html" code. I want to disable javascript...

Is there a way to catch the back button event in javascript?

Is there a way to respond to the back button being hit (or backspace being pressed) in javascript when only the location hash changes? That is to say when the browser is not communicating with the server or reloading the page. ...

In jQuery Form, 'success' is being called before 'beforeSubmit' is finished

I'm using the jQuery Form plugin to upload an image. I've assigned a fade animation to happen the beforeSubmit callback, but as I'm running locally, it doesn't have time to finish before the success function is called. I am using a callback function in my fade(); call to make sure that one fade completes, before the next one begins, bu...

Converting days since epoch to seconds since epoch

At my new workplace, they represent a lot of dates as "days since epoch" (which I will hereafter call DSE). I'm running into issues in JavaScript converting from DSE to seconds since epoch (UNIX timestamps). Here's my function to do the conversion: function daysToTimestamp(days) { return Math.round(+days * 86400); } By way of exam...

What makes this the fastest JavaScript for printing 1 to 1,000,000 (separated by spaces) in a web browser?

I was reading about output buffering in JavaScript here, and was trying to get my head around the script the author says was the fastest at printing 1 to 1,000,000 to a web page. (Scroll down to the header "The winning one million number script".) After studying it a bit, I have a few questions: What makes this script so efficient com...

Can JQuery.Validate plugin prevent submission of an Ajax form

I am using the JQuery form plugin (http://malsup.com/jquery/form/) to handle the ajax submission of a form. I also have JQuery.Validate (http://docs.jquery.com/Plugins/Validation) plugged in for my client side validation. What I am seeing is that the validation fails when I expect it to however it does not stop the form from submitting....

Reading all values from an ASP.NET datagrid using javascript

I have an ASP.NET Datagrid with serveral text boxes and drop down boxes inside it. I want to read all the values in the grid using a javascript function. How do i go about it? ...

How would you go about auto-detecting Textile versus Markdown?

I'm considering supporting both Textile and Markdown on a current project. I would prefer not forcing users to choose one or the other. Is there a way to auto-detect which the user is using? How would you go about this? I'd like to find / develop both a JavaScript and a PHP solution so I can provide live previews as well as process the u...

Is it possible to manipulate an SVG document embedded in an HTML doc with JavaScript?

I have made a SVG image, or more like mini application, for viewing graphs of data. I want to include this in a HTML page, and call methods on the SVG image. Example: <object id="img" data="image.svg" width="500" height="300"/> <script>document.getElementById("img").addData([1,23,4]);</script> Is it at all possible to call methods on...

Javascript: How to reload entire frameset onload() event including frame where Javascript is called

Is there a way to reload an entire frameset using Javascript onload() event? function logout() { ... // reload entire frame top.location.reload(); } <body onload="logout()"> This cause all frames to reload but the URL of the frame where this was called didn't changed to the URL specified in the framset. ...