javascript

Does HTML5 mean doing less with JavaScript?

Will browsers that use HTML5 use less JavaScript, jQuery, etc. and make things like animations done with just HTML? Will it make Flash less necessary for “smooth” graphics? In other words, I won’t lose anything by taking the time to learn jQuery since HTML5 is here, will I? ...

How can I optimize this code?

I have the following code (function($){ $.fn.kb = function(evt, map, fn, options) { var _this = this; var modifiers = [17, 18, 19]; function precise(a, b) { return b.Size - a.Size; } if (!this.data("Combos")) this.data("Combos", []); var combos = ...

javascript regexp can't find way to access grouped results

Hello, re = /\/?(\w+)\/(\w+)/ s = '/projects/new' s.match(re) I have this regular expression which I will use to sieve out the branch name, e.g., projects, and the 'tip' name, e.g., new I read that one can have access to the grouped results with $1, $2, and so on, but I can't seem to get it to work, at least in Firebug console When ...

Javascript REGEX : Tags

I want to convert words into tags. So for example I have an input, if I type in in this apple, windows, stackoverflow, google, microsoft then I will get this: apple windows stackoverflow google microsoft Delimiters should be space, semicolon, or comma, just like in stackoverflow :) ...

Can you solve this JavaScript issue: window focus for a faster loading pop-up

I have an issue with focusing a window. I am very new to JavaScript and any suggestion is appreciated. Kindly note that I am trying below issue in a shell which overrides many JavaScript functions. My Issue: on a single "click" action, I navigate to a new page which has 2 JavaScript methods which launch 2 external URLs which I don't own....

Custom View Engine to solve the Javascript/PartialView Issue?

I have seen many questions raised around PartialViews and Javascript: the problem is a PartialView that requires Javascript, e.g. a view that renders a jqGrid: The partial View needs a <div id="myGrid"></div> and then some script: <script> $(document).ready(function(){ $('#myGrid').jqGrid( { // config params go here }); } </sc...

Jquery 1.3.2 error on Internet Explorer. Incompatibility, or error in my code?

For a site I'm building, I import my Jquery code from... http://jqueryjs.googlecode.com/files/jquery-1.3.2.js ...but when I run the site in IE, it gives me various instances of "argument not valid" on line 4031. This happens when I hover above a field which should be animated on trough Jquery. Here is the JS code I wrote... $('body...

How to correctly use innerHTML to create an element (with possible children) from a html string?

Note: I do NOT want to use any framework. The goal is just to create a function that will return an element based on an HTML string. Assume a simple HTML Document like such: <html> <head></head> <body> </body> </html> All functions mentioned are in included the head section and all DOM creation/manipulation is done at the end of ...

Different behaviour of Javascript depending on if I type it myself or copy paste it

I get different behaviour from my Javascript depending on if I write it or copy paste it myself from the already existing code or if I copy paste it from the Internet This EXACT code gives different results depending on if the top two or bottom two are active: var tt = 5; alert(tt); //CODE; //CODE; //var tt = 5; //CODE; //alert(tt); ...

Is null an object in JavaScript?

Possible Duplicate: Null object in javascript Hi, I've read this thread about null in JavaScript, but I'm very confused about the identity of null now. As it is known that typeof(null) evaluates to object because of the language design error, and ECMA states that null is The Null Type. 8.2 The Null Type The Null type ...

How can I configure my flash object so that it won't cover my other page components?

I have this flash object that is being displayed in the middle of the page. The problem is that each time I try and open a js popup in this page, the flash object covers up the popup. I've tried setting the wmode param to "opaque" and it didn't work. I've set it to "transparent" and still no change. I've tried setting the "z-index" of t...

Is there a tool to help me understand DOM traversal in jQuery?

Hello, I think I have a basic understanding of DOM traversal, but I doubt I'm doing it efficiently. For example: <textarea name="description"></textarea> <p class="notes"><small>100 characters or less <span class="remainder"></span></small></p> I have a keyup event listener on the textarea. I want the .remainder span to display so...

Save HTML code in MySQL

I am going to save a HTML code base page as my data in mysql.... can i do it or I have to save it as a html file and get it again? ...

How to convert array to tree?

I have two arrays ["a", "b", "c"] ["a", "b", "d"] I want to convert it to { a : { b : { c : null, d : null } } } How can I do that? ...

Plot stacked chart with javascript with negatives values.

I need to plot this with javascript (excel chart): http://pontt.com/plotexcel.jpg (bar below the x-axis and bar above the x-axis). Anyone know of a javascript library (except google charts) that supports stacked bar charts with negative values and the plot just as excel? I tried several libraries, but I had no success in trying to plot...

How to change a colour of a word in jquery

How would i be able to select a word and change the colour of that one word? e.g. add a span with style and chage the font colour. Can someone lead me down the right path please. Jquery function edit_addon (div_id) { $("#"+div_id).attr ('contentEditable', true) .css ('color','#F00') .css ('cursor'...

How can I find the button that was clicked from the form submit event in jquery?

I have a function that I'm using to prevent multiple postbacks of a form: var submitted = false; $(function() { $('form').bind('submit', function(e) { if (!submitted && CanSubmit(e)) { submitted = true; return true; } else { return false; } }); }); In the CanSubmit me...

How to add a character to this validation function?

$(function(){ $('input[name="username"]').keydown(function(key){ if (jQuery.inArray(key.keyCode, [8,37,39,48,49,50,51,52,53,54,55,56,57,65,66,67,68,69,70,71,72,73,74,75,76,77,78,79,80,81,82,83,84,85,86,87,88,89,90]) == -1 || key.shiftKey ){ return false; } }); }); What t...

Using the Streampad API to pull the current song title

I can't figure out how to pull the song title from the Streampad API. This is straight from the Streampad API website. SPAPI.song():Object Returns the current song that is playing. Object will have these properties: songTitle, artist, album, imageUrl (link to album cover art), sourceUrl (link to page containing song), ...

How do I validate a string in JavaScript?

Have a text input box. Would like the user to enter a string in the exact format: 2010/08/26 17:04:51.24 (with any numbers of course) How can I do this efficiently? Not looking for the answer, just a point in the right direction. Thank You. (html, JavaScript and jQuery) ...