javascript

How can I reload a page using jQuery from Greasemonkey?

I'm working on a Greasemonkey script that occasionally reloads a page and checks for updates. I'd like to be able to do a full-page reload without the side effect of having the page's title show "Loading..." each time. Here's what I have so far. The jQuery loading code is from http://joanpiedra.com/jquery/greasemonkey/ // Add jQuery ...

Order of SPDocumentLibrary menu items using Custom_AddDocLibMenuItems

I'm adding a custom context menu item to documents (and not folders) in a SPDocumentLibrary list in SharePoint. The following code works, but always adds my custom menu item at the top of the context menu, which I don't want. I was guessing that the final parameter in CAMOpt was a sequence number that would define the order, but it doesn...

how to create an nsIFile object using URIs

I'm making extension for firefox, and I want to my extension open a file like "file:///home/blahblah/foo.txt" and then put content of this file in text area. Its easy with files "http://", but i cant do this with "file://" ...

javascript page rotation/refresh

How can i get javascript to take a list of URL's, and refresh an iframe with the next URL on the list after a given number of seconds, in this case 45 seconds. The list is named list.txt (one full URL per line), and the id of the iframe is #window. ...

Javascript - getElementById fails if anchor also has a name attribute

I'm running into an odd failure. It seems that if I have both an ID and NAME attribute on an anchor element, document.getElementById fails. If I remove the NAME, it works. I'm seeing this in Firefox 3.5(latest) but haven't checked other browsers yet. Is this a bug or intentional? ...

jQuery $('form').serialize() returns only one element of a form serialized

Given the following form: <form id="form" name="form"> <input name="name"/> <input name="version"/> <input name="template"/> <textarea name="elements"></textarea> <textarea name="features"></textarea> <textarea name="layout"></textarea> <input type="submit" value="Save"/> </form> and javascript (using jQuery 1.3.2): $(function() { ...

CSS issue: Top border not displaying in IE

On my site, I'm using the JavaScript Tabifier to create tabs In Firefox, the tabs have a top border (as desired). In IE 6/7, the tabs do not have a top border, even though I have border-top defined for the appropriate CSS property (ul.tabbernav li a). Any CSS ideas as to why Firefox has the top border but IE does not? UPDATE Per com...

Javascript: How to create an array of object literals in a loop

Hi, I need to create an array of object literals like this: var myColumnDefs = [ {key:"label", sortable:true, resizeable:true}, {key:"notes", sortable:true,resizeable:true},...... In a loop like this: for ( var i=0 ; i < oFullResponse.results.length; i++) { console.log(oFullResponse.results[i].label); } The value of '...

Display XML island

I am using javascript with several XML islands. One of my islands is coming back null and it is when it is being loaded by another Island. I was hoping someone knew of a way to display what is in these islands. Everything is in a xhtml file with xslt files assisting it. Island1.XMLDocument.loadXML( Island2.XMLDocument.xml ); Island1 i...

ASP.NET - Client-Side OnClick Event of Button is Breaking Page Validation

I have a button on a form that saves a unique value to my database and to prevent the user from submitting twice and getting an error I added some JavaScript logic to do a client-side disable of the button after it is clicked. Functionally this all works, but it created an unexpected side effect that field Validation is being fired on a...

Convert String to XML Document in JavaScript

Saw this example on the jQuery examples page for Ajax: var xmlDocument = [create xml document]; $.ajax({ url: "page.php", processData: false, data: xmlDocument, success: someFunction }); How do I take a string like: var t = '<foo><bar>something</bar></foo>'; And convert that to a XML DOM object? cross-browser? UPDA...

Unpredictable hierarchy in JSON object...

When building an ajax application, I normally prefer fetching remote data in JSON format. However, when the hierarchy is unpredictable (specifically geocoding responses from Google Maps API), it is tempting to go with XML format because the DOM method getElementsByTagName will get the data wherever it is in the hierarchy. Assuming there ...

jQuery Change picture on link click (matching with the same number in id)

Hi, I got a generated list of links where every link has an unique id(number) and a class called "load". I would like to change a picture on the other side of the page with the same number in the id as the link I clicked. Since id on elements are unique, i added folderid[number] infront of all the images This is what i have so far (no...

Add events to anchors when using link_to and :method => :post instead of inline javascript?

So I'm jumping into Ruby on Rails with Agile Web Development with Rails. I got to the part where you use: <%= link_to (image_tag(product.image_url), {:action => :add_to_cart, :id => product}, :method => :post) %> In an attempt to be RESTful, Rails kicks out this inline javascript on each anchor tag onclick="var f = document.createEl...

Disable browser toolbars, menu bars etc when the page loads

Hi All, I am trying to figure out a way to disable toolbars, scrollbars etc when the page loads, using JavaScript or ASP.NET. i know i can use this window.open('default.aspx', 'google', 'height=800px,width=480px,location=no,toolbar=0,directories=no,status=no,menubar=no,resizable=no,scrollbars=no'); but I dont want to open a new win...

update jquery validation plugin dateISO javascript

Right now...the dateISO method is as follows: dateISO: function(value, element) { return this.optional(element) || /^\d{4}[\/-]\d{1,2}[\/-]\d{1,2}$/.test(value); }, but ive noticed that when a user enters something like 1991-99-99 it sees it as a "valid date" when it obviously is not. How would i change this code to have it check i...

Clearing Input Fields with JavaScript

I've been looking at this for the last few hours, and can't really achieve what I'm looking for. I currently have the following two inputs: <input type="text" id="username" value="USERNAME" onfocus="inputFocused(this)" onblur="inputBlurred(this)" /> <input type="password" id="password" value="PASSWORD" onfocus="inputFocused(this)" onblu...

Determine Document Order from Nodes

If I have two nodes in an HTML document, how can I tell which one comes first in HTML document order in Javascript using DOM methods? For example, function funstuff(a, b) { //a and b can be any node in the DOM (text, element, etc) if(b comes before a in document order) { var t = b; b = a; a = t; } // process the...

Changing a sIFR "Current Item" Color without Page Reload

Greetings! I found a post similar to my problem that was nicely answered, but it changed the color of ALL <h1> instances with a javascript function. I am trying to change the color of a single sIFR'd nav item in a list to have a different color, without reloading the page -- so the others would have to be "turned off" (color reset to ...

How do I convert a c# two-dimensional array to a JSON object?

If I have a two-dimensional array in C# - how can I convert it into a JSON string that contains a two dimensional array? eg. int[,] numbers = new int[8,4]; JavaScriptSerializer js = new JavaScriptSerializer(); string json = js.Serialize(numbers); gives a flat one-dimensional array in a JSON object. The Microsoft documentation states:...