javascript

How do I make vim indent JavaScript in HTML?

Vim 7.0.237 is driving me nuts with indentexpr=HtmlIndentGet(v:lnum). When I edit JavaScript in a <script> tag indented to match the surrounding html and press enter, it moves the previous line to column 0. When I autoindent the whole file the script moves back to the right. Where is vim's non-annoying JavaScript-in-HTML/XHTML indent? ...

jquery ajax events called on every element in the page when only targeted at one element

So, you have a page: <html><head> <script type="text/javascript" src="jquery.1.3.2.js"></script> <script type="text/javascript"> $(function() { var onajax = function(e) { alert($(e.target).text()); }; var onclick = function(e) { $(e.target).load('foobar'); }; $('#a,#b').ajaxStart(onajax).click(onclick); }); </script></head><body> ...

IE7 complaining about label ID in javascript

Ok, I am developing a simple program to do xmlhttprequests so I can get a handle on how they work. On that page I have a simple text box, a label, and a button. When the button is clicked it sends out a request to another page via the javascript method, and it stores the response in the label. (this is all the code in the body) <form...

how to get a js png fix to work on ajax calls

we're using js to do png replacement, and we also have ajax updates on some of these elements. when the page fragment gets updated, the png fix gets lost, since the png fix traverses the dom and replaces png bg images when the document loads. is there a way to render the png replacement when the ajax update takes place, rather than only ...

Rendering Javascript in an asp.net master page at a specific spot

Hi, I've a specific requirement of rendering Javascript onto a master page of an asp.net site. There are two specific requirements of it: 1) The position - It should be rendered at the very end of the page just before BODY tag 2) Control - Render it only when requested. I solved #2 by creating a web-part which will render the javascri...

changing param value of object in html using ajax

Hello all, I am building a small web application to run midi files. Currently I am using quick time to play the midi files. The problem is that I do not know to what source I need to tie the object until the user enters some information (something like a search ). I need to be able to update the quicktime movie to the correct path. Is i...

How do I disable all input buttons without using jQuery?

How would I do this without jQuery? $('input[type=submit]').attr('disabled',true); It doesn't have to be cross-browser compatible; a solution that only works in Firefox is OK. ...

Problem creating a scrollable content area with height defined in percentage

Hi , We are creating a web page with header, content and footer. The header and footer should be visible at all time and the content should be scrollable. The container div has a fixed width but no fixed height. I solved the problem of keeping the footer at the end by using css sticky footer (http://ryanfait.com/sticky-footer/) The con...

Multi-level Complex Rails Forms

Hi, I'm trying to create a multi-level ajax form on my rails app that can add/remove fields associated with a new object in a form when a button is clicked. However, I need to have multiple levels to this form (i.e. if someone adds a "Meal" object, there must also be a button inside the created "Meal" form for "Add a food".) I follow...

IE: Clone XML Data Island into IFrame

First off, YES, this is for IE and IE only. NO, I cannot deviate from that. I am working on a corporate intranet application and I have no say whatsoever about the client browser; thus, it is IE (and IE 6, at that). Now, the gist of what I'm trying to do is this: the application houses several XML data islands, and at times I need to pr...

Styling Divs with Javascript Vars

Hi, I'm doing a little experiment trying to randomly place images inside a div using a javascript loop. I've been having some trouble with it. Here's what I have (simplified): for(var i = 0; i < 10; i++) { var top = random(-20, 20); var left = random(-20, 20); document.write( <div class="one" style="\"left:" + left + ";\""> <img...

Javascript question: How do I duplicate user input into a hidden field?

How can I pass input from a text-type input element into a hidden input element in the same form on a site that has jquery installed? ...

Jquery .post and form data

I am using .post to post my data to my controller. I would like to pass all the data that I have in a form. Is there an easy way to take all the form data and add it to the .post command to send it? ...

injecting arbitrary HTML string into document (javascript) - updated

Update: I just narrowed my problem to this: Why doesn't this work: var tmp = document.createElement('tbody'); tmp.innerHTML="<tr><td>hello</td></tr>"; tmp is getting the string hello. the tr and td html is lost (on FireFox). Why is that? and how can I make such html injection work? Original question: I need to inject arbitrary HTML...

Get an id for a form item after its class has triggered a jquery change function

hey, sorry if this is pretty vague.im happy to provide any further information should it be needed. Im working on a webpage which uses the jquery change() function to perform updates on the page with regard to the users input, for example change the color of a div depending on what the user enters.Each form entry is part of the class "f...

What is the best way to check if an object is an array or not in Javascript?

Say I have a function like so: function foo(bar) { if (bar > 1) { return [1,2,3]; } else { return 1; } } And say I call foo(1), how do I know it returns an array or not? ...

How do I render a bar similar to images.google.com ?

How does images.google.com render its frames?? I have two servers, that have external web viewable content, and an internal search engine that only admins can use. The external content cannot be edited, it was created with some proprietary technology. What I want to do is allow my internal admins to see a bar that allows them to perfor...

Auto-saving via XmlHttpRequest from EditorGridPanel in ExtJS 3.0?

I have an EditorGridPanel in Ext JS 3.0, populated via HttpProxy and JsonReader, and I have an editable column "working"--I can edit the value and it flags it as dirty. Now, how do I get it to, after a cell has been edited, send an XmlHttpRequest to the server with a few base parameters, the row's ID field, the name of the column change...

list of javascript objects/features unique to a given browser?

Has anyone seen a list of features unique to a given browser? For example, if you want to target just IE 8 acting like itself, you could do: if (typeof document.documentMode != undefined) { if (document.documentMode == 8) { ...stuff } } Likewise, for all versions of IE you could check for window.clipboardData . But what about Fir...

Firefox Extension - Multiple XMLHttpRequest calls per page

I am trying to create a Firefox extension that can run multiple XMLHttpRequests per page. The code is below (my main function calls the makeRequest on different URLs). My problem is that it always returns (at the "alert('Found ...')" for debugging purposes) the same URL instead of displaying the different responses. I think the issue is ...