javascript

"Custom" ScriptManager control?

I'm looking to build a control that essentially abstracts a ScriptManager. I need it to look/feel just like as close to a regular ScriptManager as possible. The reason for this is so we can use an "#if not DEBUG" statement to dynamically load the .js files in CompositeScript for release, but also maintain easy debugging in our dev envir...

Periodically Animating-up a Number with Javascript

I've got an element on my page that I would like to increment from time to time: <p class="count">28</p> Within my javascript, I have an interval that runs once every 5 seconds and asynchronously grabs the new (higher) number from the server. This functions somewhat along the lines of a counter. setInterval(function(){ $.post("getc...

Is there any Javascript library that provides drag'n'drop creation/editing of form elements?

I am writing a web application that lets a user create their own forms by dragging and dropping input elements (textfields, textareas, etc.). Currently, the user is able to add / reorder (up or down) / remove form elements, but I need to make them freely draggable. Some time ago I have seen a tool written in Javascript that lets a user...

Advanced JavaScript/JQuery Design Patterns

What are the best resources on Design Patterns catering specifically to web development with JavaScript and JQuery? I'm particularly interested in information on programming my own libraries, reusable components, widgets, etc. and the merits of various techniques (for instance in the case of components/widgets comparing those employed i...

Toggle (click) and bind event (on document)

Hi, I have a button <a> that should toggle a drop-down Then it should also bind (once) a click event to the document that when clicked it should slide it up. I started with this HTML and JS... Any suggestions how to make this work? HTML <a class="a" href="#">continue shopping</a> <div class="b"> <a href="#">contin...

Is there anyway to implement XOR in javascript

I'm trying to implement XOR in javascript in the following way: // XOR validation if ((isEmptyString(firstStr) && !isEmptyString(secondStr)) || (!isEmptyString(firstStr) && isEmptyString(secondStr)) { alert(SOME_VALIDATION_MSG); return; } Is there a better way to do this in javascript? Thanks. ...

rails // format.js or format.json, or both ?

might be obvious, but still i'm lacking here of basic knowledge. so inside controllers, can both be used, or is it always javascript, so both are the same ? ...

Google Libraries - URL version selecting

Reading through documentation, I found following: 1.9.1 1.8.4 1.8.2 A version of "1.8.2" select the obvious, fully-specified version. Specifying a version of "1.8" would select 1.8.4 since this is the highest version released in the 1.8 branch. For much the same reason, a request for "1" loads version 1.9.1, since t...

Javascript to compare two dates, from strings, begin <= end

I get two strings formated like (Brazilian Format): "DD/MM/YYYY", I need to compare both. Since the first field is the begin and the last is the end, My validation is begin <= end Date.new(begin) is generating 'invalid date' even on ISO ! ...

pain of browser back button

Is there any way using JavaScript(or something else) to detect/prevent that user clicked on browser back/forward button ? I would like to know about the common practice to deal with this issue. This is really pain especially in the work flow like ordering. ...

Facebook extended permission dialog cut-off - not showing allow/disallow button

Using js inside an iframe to ask for extended permissions: FB.ensureInit(function() { FB.Connect.showPermissionDialog("publish_stream", submit_post); }); the dialog pops up, but the lower half of the dialog is hidden and the user can't possibly click allow (or disallow for that matter) has anyone seen this? what co...

Changing checkbox visibility

I would like the button on my web page to toggle the visibility of my two check-boxes. How do I go about implementing such functionality? <html> <head> <script language=javascript> function validate(chk){ if (chk.style.visibility == 'visible') chk.style.visibility = 'hidden'; else chk.style.visibility = 'visible'; } </scrip...

jquery get styles from an id

does anyone know how can i get all styles applied to an id using jquery (so i can reuse it later in another tag)? something like css: div#myid{ width:100px; height:100px;} so i can later do something like: for (var parts in $('#myid').css()) alert ('all parts of the style' + parts); ...

Playing YouTube embedded videos consecutively on one page

Hi, I'm embedding YouTube videos onto my webpage with something like this <object width="425" height="344"> <param name="movie" value="http://www.youtube.com/v/RU-bMtPz1cY"&gt;&lt;/param&gt; <param name="allowFullScreen" value="false"></param> <param name="allowscriptaccess" value="always"></param> <embed src="http://www...

Javascript: Get access to local variable or variable in closure by its name

Hi all. We all know that you can access a property of a javascript object by it's name using the [] syntax.. e.g. ob['nameOfProperty']. Can you do the same for a local variable? Another answer here suggested the answer is to use window['nameOfVar']. However, this only worked for the poster as he was defining variables at window-level ...

jQuery validation plugin problem when served by JSP using @include

Greetings! I'm trying to combine several JS files into one and serve it through JSP but I'm running into a problem with the jquery validation plugin 1.6 The JSP aggregating various .js files: <%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %> <%@ page contentType="text/javascript" pageEncoding="UTF-8" %> <c:if test="$...

Are DOM style calls limited by frequency?

I'm trying to resize an html element (flash object) but it doesn't seem to respond more than once per second? Is this a limitation imposed by browsers (both IE7 and FF3 do this)? Or should I be attempting to resize in a different/more efficient way? function setHeightNow(height) { if (document.getElementById) { if (height >...

Is there a general purpose JavaScript library out there?

We started a new project and realized that we needed a general purpose javascript library that contains a nice set of string functions, MD5, base64, allows extensions, etc. Also, copying and pasting functions from other libraries doesn't sound very attractive. So, I guess the question is which javascript library contains the most gener...

hidding a draggable after dropping it (scriptaculous)

probably best if i first just write my code down. i have: <li class="sorted" id='<%= domid %>'> <%= horse.name %> </li> <%= draggable_element(domid, :ghosting=>true) %> after the drop on some "box" the draggable element with name = horse.name stays on it. i want to delete it(the name). i was trying different things. supposedly i ...

Javascript to insert IFRAME

I'd like to give people the ability to insert a single Javascript line into their site which effectively allows me to insert an IFRAME of a fixed size that contains content from my site. It's effectively a widget which allows them to search my site or receive other information. Is this possible? ...