I'm currently using the following function which is based on an example from the web, it is called every second to display the current progress through a video stream.
Is there something I could do to make this more efficient?
function secondstominutes(secs){
var s;
if(secs > 60){
var min = Math.floor(secs / 60);
s = min < 10 ? "0...
I'm looking for a JavaScript Testing Framework that I can easily use in whatever context, be it browser, console, XUL, etc.
Is there such a framework, or a way to easily retrofit an existing framework so its context agnostic?
Edit: The testing framework should not be tied to any other framework such as jQuery or Prototype.js and should...
Hi,
Using .net MVC and I am doing some server side validation in my Action that handles the form post.
What is a good technique to pass the errors back to the view?
I am thinking of creating an error collection, then adding that collection to my ViewData and then somehow weave some javascript (using jQuery) to display the error.
It w...
I am using a jQuery plugin to set cookies and when I use localhost for the domain it will not store the cookie.
Here is the plugin I am using with jQuery 1.2.6.
http://www.stilbuero.de/2006/09/17/cookie-plugin-for-jquery/
Below is the code that I am using. You can see it does not like localhost, and I am running it from a development ...
I have HTML form with a lot of inputs. I'm interesting in situation when I have focused input, after that I scroll page and focus is messed.
...
I am calling a web Method from javascript. The web method returns an array of customers from the northwind database. The example I am working from is here: Calling Web Services with ASP.NET AJAX
I dont know how to write this javascript method: CreateCustomersTable
This would create the html table to display the data being returned. Any...
Consider an HTML form:
<form action="" method="POST" onsubmit="return checkValidArray()">
<input type="text" name="data" onchange="return validate(this);">
</form>
It appears (in both IE 6 and Firefox 3) that when you type some text into the input field and click submit that the onchange event fires for the input field, but the on...
How can i get the current time? (in JavaScript)
Not the time of your computer like:
now = new Date;
now_string = addZero(now.getHours()) + ":" + addZero(now.getMinutes()) + ":" + addZero(now.getSeconds());
But the real accurate world time?
Do i need to connect to to a server (most likely yes, which one? and how can i retrieve time ...
I'm doing some string replacement on text I'm getting back from a JSON web service, the string may look like this:
"Hello I am a string.\r\nThis is a second line.\r\n\r\nThis is a bigger space"
I want to replace all the \r\n with <br /> tags so that the HTML is formatted, but when I do:
var string = result.replace('\r\n','<br />');
...
I am a Google Maps API (javascript) developer. I have noticed that Google uses a Javascript minifier that has the following features:
Shortens variables, properties, arguments, classes, function and method names, obfuscating the code. (eg. function1 -> a, function2 -> b, function3 -> c)
Some variables, classes, properties and methods c...
I am building an iframe that will go into my clients' web pages. I need to figure out if the user's browser supports javascript and serve back the either the javascript or non-javascript version of the page accordingly.
What's the best way to determine javascript support in this case? I thought about using javascript to rewrite the ...
I know, I know, another layer on top of the libraries, but I think there could be some benefits when it comes to porting certain functionality. I thought I would ask and see if anyone has found anything related to this. Essentially it would be a bunch of getters and setters, and any one of the major libraries could sit inbetween. Has any...
I'm currently developing a tutorial site for teaching the fundamentals of Web development (HTML, CSS, and JavaScript, for starters). I'd like a setup where I could give in-depth coverage of all sorts of topics and then provide a basic sandbox environment where the user could write code which solves the question asked at the end of each t...
I have a problem in my C# ASP.NET application, where the id and name tags are modified at runtime with a prefix "MainView_" and "MainView$" respectively. So my code:
<asp:Button ID="OKToContinueCheckInButton" runat="server" CausesValidation="False" Visibility="false" Style="display: none" OnClick="btnOKToContinueCheckIn" />
<script ty...
I'm having some trouble getting jQuery to play nice with DokuWiki - has anyone already done this successfully?
At the moment, including jQuery reuslts in all sorts of JS functionality breaking, and I'm having trouble tracking down the source of the problem. What are some things to look for that tend to conflict with jQuery?
...
Hi, I just want a very handy way to extract the numbers out of a string in Javascript and I am thinking about using jQuery, but I prefer the method that proves to be the simplest. I have requested the "left" attribute of a css block using jQuery like this:
var stuff = $('#block').css("left")
The result of "stuff" is
1008px
I just w...
I have about 7 Javascript files now (thanks to various jQuery plugins) and 4-5 CSS files. I'm curious as to what's the best practice for dealing with these including where in the document they should be loaded? YSlow tells me that Javascript files should be--where possible--included at the end. The end of the body? It mentions that t...
Ok, I've rolled my own theme, I've made a custom jQuery UI pack (progress bar, date picker, slider) and installed it all. Seems to (mostly) work except for two things:
When my page first loads the datepicker div is visible; and
The text "Next" and "Prev" are visible in large font underneath my icons. None of the examples seem to have...
I hear all these bad things about the DOM.. Don't use the Activex object, XmlDom, or is it "dom".. oh God you are using the DOM? What is the straight on this usage.
But we use document.GetElementbyId and ...Name all the time..
So what am I actually using when invoke these methods? Is this is what the browser is uing...
The company ...
I'm wondering what the most viable approaches are for 2d game graphics, running in straight (and cross-browser) Javascript?
I've found the canvas and SVG approaches so far. Are there other straightforward methods that offer primitive graphics operations like drawing lines, circles, pixels? Preferrably supported out of the box in IE, unl...