javascript

Why do I get a jQuery syntax error with .post and hide("slide")?

After I do the .post thing, I want to hide the first div with a left slide, then show the second with a right slide. My right-slide was working fine and then I went and tried to put in the left slide and I broke it all. if(hasError == false) { $.post("/process-email-signups",{email_address: email_addressVal}, function(data){ ...

pure CSS minimized-height header, maximized-height body within an absolutely positioned DIV

I have an HTML editor widget that I want to appear within an absolutely positioned, fixed-size DIV. However, I don't know the absolute size of the DIV beforehand, and it may change, like if the user resizes the window. The editor, naturally, has controls and an editable area. Each has their own DIV. I want the controls to take up as ...

Sys.InvalidOperationException: Handler must be a function.

I've a webpage which contains a TabContainer <%@ Register Assembly="AjaxControlToolkit" Namespace="AjaxControlToolkit" TagPrefix="cc1" %> ... .... <form id="form1" runat="server"> <asp:ScriptManager ID="sm1" runat="server"></asp:ScriptManager> <cc1:TabContainer runat="server" ID="tbcTabContainer" OnClientActiveTabChanged="Change...

Displaying high resolution image

I have a really high resolution images (e.g. this one) that needs to be viewed. I would like to either fit it into the browser screen or have user scroll around the picture (without changing the image). What are some good ways to do such things? I'm guessing that there is a way to do this with CSS (using width/height) or Javascript. I...

Best Practice in Integrating JavaScript Actions w/ DOM

Let's assume, for instance, an xHTML document as below: <html> <head> </head> <body> <div id="wrapper"> <div id="sidebar"></div> <div id="content"></div> </div> </body> <script type="text/javascript" src="http://code.jquery.com/jquery-latest.min.js"&gt;&lt;/script&gt; <script type="text/javascript" src="./application.js"></script> <...

Is there a native jQuery function to switch elements?

Can I easily swap two elements with jQuery? I'm looking to do it with one line if possible I have a select element and I have two buttons to move up or down the options, and I already have the selected and the destination selectors in place, I do it with an if, but I was wondering if there is an easier way ...

Ajax call in a jQuery plugin not working properly

I'm trying to create a jQuery plugin, inside I need to do an AJAX call to load an xml. jQuery.fn.imagetags = function(options) { s = jQuery.extend({ height:null, width:null, url:false, callback:null, title:null, }, options); return this.each(function(){ obj = $(this); //Initialising the placehol...

JavaScript idiom: create a function only to invoke it.

I am learning YUI and have occasionally seen this idiom: <script> (function x(){ do abcxyz})(); </script> Why do they create a function just to invoke it? Why not just write: <script> do abcxyz </script> For example see here. ...

Loading iframes by clicking a div with nested divs

I have a setof divs with nested items <div id="second-item" class="dock-item"> <div class="website-name">Facebook.com</div> <div class="website-screenshot"><img src="fb-thumb.png" /></div> <div class="page-name">Facebook</div> </div> <div id="third-item" class="dock-item"> <div class="website-name">Mozilla.com</div> <div c...

Faster way to populate <select> with Javascript

I have two <select> boxes on a form. Selecting an item in the first <select> box will determine what should appear in the second <select> (Using Ajax http_request). In some cases there can be a large 500 (guess) items in the second select and it takes time 5-10 seconds to update in IE. Firefox seems to work perfectly. I wonder if th...

Link_to method and onClick event in Rails

Hi there. I have a small problem. How to create a link of this type: a href="#" onClick="document.getElementById('search').value=this.value" using method 'link_to' in Rails? P.S. I write http://api.rubyonrails.org/classes/ActionView/Helpers/UrlHelper.html, but I can not imagine how to make such a link. ...

Parsing xml using javascript outside of browsers?

I need to be able to parse an xml file inside photoshop, using javascript. I tried activex but it didn't work. How do I go about parsing it. Does javascript itself has an xml parser? ...

Multidimensional Arrays and jQuery's getJSON

I am submitted a getJSON request to a controller in my application, this controller is returning valid JSON with 2 "applications." I know this for a fact as if I move the alert statement to within jQuery's each function it will give me the expected result. I am attempting to store this data within a multidimensional array to later be us...

Is there a jQuery selector/method to find a specific parent element n levels up?

Consider the following HTML. If I have a JSON reference to the <button> element, how can I get a reference to the outer <tr> element in both cases <table id="my-table"> <tr> <td> <button>Foo</button> </td> <td> <div> <button>Bar</button> </div> </td> </tr> </table> <script type="text/js"> $('#table button').clic...

Submitting a form on 'Enter' with jQuery?

I have a bog-standard login form - an email text field, a password field and a submit button on an AIR project that's using HTML/jQuery. When I hit Enter on the form, the entire form's contents vanish, but the form isn't submitted. Does anyone know if this is a Webkit issue (Adobe AIR uses Webkit for HTML), or if I've bunged things up?...

Good non-intrusive anti-spam email obfuscator?

I'm trying to come up with a JavaScript email obfuscator to reduce the chance for spam in emails listed on a web site. Right now I've got a JavaScript based obfuscator that uses a combination of HTML encoding & JavaScript to convert an obfuscated email into a normal email transparently. What I do is this: Format the "mailto:" part of ...

Methods to detect which social networks users visit?

Are there recommended ways to determine which social networks my users are part of? I have the know-how to build a system that does this but I wanted to get other people's opinions and recommendations on how they might do it as well. ...

What is this kind of javascript? And Help with AJAX request.

I recently asked this question: http://stackoverflow.com/questions/694849/dynamically-query-a-database-to-check-for-value/694860#694860 And I got an awesome and informative answer. But whenever I search on Google to find out more about "Ajax Requests" the codes never look similar to the one provided. Also I have used another tutorial t...

How can I use Javascript to display an information message next to the mouse pointer?

How can I use Javascript to display the information message next to the mouse pointer when the mouse pointer hovers over a link or button? The information will always be next to the mouse pointer until the mouse moves out of the link/button. ...

Javascript/css/php/mysql to collect user email addresses in a div on a website.

Suppose you want a box on your website that says "Give us your email address and we'll send you news" or somesuch. What's a simple/elegant way to collect those email addresses (assuming a standard LAMP stack)? In particular, I'd like recommendations on Javascript to handle the UI (complain if invalid email address, say thanks when t...