javascript

clearing an <a> href after the page is loaded using jquery

I'm trying to slightly modify a wordpress template. At the moment a function returns a link to an article, I am trying to replace this link so that instead of diverting you to another page it just brings the article in and loads it. To do this I need to reset the anchors href after the page has loaded. This is the bit of code I am int...

Right shift operator on mac safari not working

Hi all, I am writing some code and used >> (right shift operator) , the ui is totally messed up.I debugged and found that its doing wrong math and finally found right shift operator is not working mac safari. Is this a known behavior or i am doing something wrong. ...

jQuery: Templates. Must be contained in script block?

As a JS developer, I always keep my design layer separate from my business layer. Meaning, HTML is always alone, CSS and JavaScript files are external and included. Now, in the case of jQuery Templates, a declared template must apparently live within a script block of the page. How in the world are you supposed to keep all of your busin...

JavaScript: Cross-browser "browser plugin" detection

I'm looking for a script that will allow me to detect if a user has Windows Media Player installed, or Quicktime, or Flash, or Silverlight... Ideally, this would be jQuery plugin, but any script will do. Do you know of one you can recommend? ...

What charting technology is being used on nextbigsound.com?

It's looks like they are using an all javascript based solution. Are they using a package out there are did they roll their own solution? ...

jQuery Template Plugin or custom functions?

What I've got are chunks of code that are used over and over again in HTML. For example: <div class="row"> <span class="label"></span> <span class="control"> <!-- content here --> </span> </div> Here we have a simple row that I use in forms. Naturally, this chunk of code happens over and over, page after page. I'm ...

FOR loop and string concatenating with JavaScript gives me an undefined value

I have the array var data = [name, address, city, country]; And the loop var columns; for (var i = 0; i < data.length; i++) { columns += "data[" + i + "], "; } columns = columns.slice(0, -2); alert(columns); The alert message says undefineddata[0], data[1], data[2], data[3] What am I doing wrong here? I want to remove the u...

Private javascript widget

Hey all, I'm considering embarking on a new project. The premise of the project is generate a widget on my site, then copy a piece of javascript into your site and viola you have your widget. It's a new spin on existing services such as polldady.com, twiig.com and addthis.com. Many of these such services are designed to be publicly ac...

Reading the contents of Clipboard in FF

I am able to do that in IE, but FF doesn't allow to do something like: $("#txtBox").bind('paste', function (e) { alert('pasting text!!!!'); alert(window.clipboardData.getData("Text")); window.event.returnValue = false; }); I am required to trap the clipboard contents onpaste, then populate a t...

How do I change the stepping of y-axis values in Flot?

I have a graph of memory use over time which looks like: I set the y-axis: { max:n } value n to 1024 (which means 1024MB of RAM). How do I get Flot to change the y-axis labels so they display: 1024 768 512 256 128 0 ...

Javascript RegExp quantifier issue

I have some JavaScript that runs uses a replace with regular expressions to modify content on a page. I'm having a problem with a specific regex quantifier, though. All the documentation I've read (and I know it work in regex in other languages, too) says that JavaScript supports the {N}, {N,} and {N,N} quantifiers. That is, you can spec...

Would the javascript .split(' ') leave the commas in the array?

I have a space separated string that I want to make into an array. I am using the .split(' ') method to do this. Will the resulting array have those spaces in it? For example if my string is "joe walked down the street" and I performed the method on it would the array look like this ["joe", "walked", "down", "the", "street"] or will it l...

How to make a toolbaritem appear by default for a Firefox extension?

I'm adding a toolbaritem with a child toolbarbutton to <toolbarpalette id="BrowserToolbarPalette"> in a browser overlay for a Firefox extension which I'd like to be displayed by default when the extension is first installed. What's the best way to do this? ...

JavaScript sound library the doesn't require HTML 5 or Flash

Is there a reason that all of the audio javascript libraries I'm finding (jPlayer, SoundManager 2, etc.) try to use HTML 5, and if that doesn't work attempt to use Flash but then don't fall back to anything else? Why wouldn't they try to fall back to the default HTML sound tags like <embed>, <object>, or <bgsound>? Is there a library o...

jquery selector problem

I'm trying to select a div with the id "about me". I think I am having problems because of the spaces. alert($link.attr("title")); I get "about me" alert($('#'+$link.attr("title")).attr("title")); I get undefined. I have tried to use php and jquery methods for removing them but it doesn't work. So how do I get around this? ...

Alternatives to setTimeout after an Ajax callback

I find myself doing this a lot: window.onload = function(){ $.get("http://example.com/example.html", function(data) { $('#contentHere').html(data); setTimeout("javaScriptClass.init()", 200); }); } But setTimeout seems a bit hacky (and 200ms is already over three times the attention span of the average user :). ...

Attach a script to a DIV While performing an AJAX request

I have this script <div id="div2"> <div class="bar1"></div> <div class="bar2"></div> <div class="bar3"></div> <div class="bar4"></div> <div class="bar5"></div> <div class="bar6"></div> </div> <script> function rotate() { var count = 0; var elem = document.getElementById('div2'); elem.style.MozTransform = 'scale(...

What's the best way to be notified when an extension's toolbaritem is being used?

I want to setup label attributes, and event listeners for a toolbaritem when it's being used. Because even though I add my extension's toolbaritem to <toolbarpalette id="BrowserToolbarPalette"> it is not found by document.getElementById unless it is being used. At the moment I have DOMNodeInserted event listeners on the navigation bar an...

Gett values of Html. controls in ASP.NET MVC with AJAX as user interact

Hey guys, I'm doing an ASP.NET MVC project just for learning...and stuck in this... I'm trying the get the value from the Html.TextBoxFor(model => model.ShortName) and show in the side www.blablabla.com/Value, it in the time of the user is typing. I tried to add the AJAX library reference on the top: <script src="../../Scripts/Microso...

Javascript and HTML: Saving file as UTF-8 without BOM

I'm trying to write an MSIE only HTML page (which I'll call the "Title Page") that allows someone to save a generated HTML webpage (which I'll call "New Page") with a click of a button. What I found out is that the "Save As" dialog box that appears does not allow for the "New Page" to be saved as UTF-8 without BOM. It is instead, being...