javascript

How to create a tree structure in Javascript DOM?

Hi, This is going to sound too silly / too basic - sorry about that, but I experimented a lot and couldn't come to the right solution! I'm using this following piece of code - which makes a row of text fields go up and down. Unfortunately, the up and down movement doesnt stop and carries on throughout the page! :) function up(row) { ...

Next/Previous click jQuery UI

I am trying to add next/previous buttons on a button click using the jQuery UI Slider. I found this code... $("#down").click(function() { var s = $("#slider"), val = s.slider("value"), step = s.slider("option", "step"); s.slider("value", val - step); }); $("#up").click(function() { var s = $("#slider"), val = s.slider("value"), s...

How to click a link that has javascript:__doPostBack in href?

I am writing a screen scraper script in python with module 'mechanize' and I would like to use the mechanize.click_link() method on a link that has javascript:__doPostBack in href. I believe the page I am trying to parse is using AJAX. Note: mech is the mechanize.Browser() >>> next_link.__class__.__name__ 'Link' >>> next_link Link(bas...

String strip() for javascript?

What's a clean and efficient Javascript implementation to strip leading and trailing spaces from a string? for example " dog", "dog ", " dog ", " dog " all get turned into "dog" ...

In ASP.NET, how to process data on both client side (javascript) and server side with the one form submission?

I have a scenario where I am using Google Map JavaScript API to process the address after user submits the form. However, I want to post result, that Google API returns back, to server side for further processing within the same form submission. How can I achieve this? Thanks in advance for your advice. ...

Jquery accordion, next and previous wizard, how to get previous and next sections?

Hi I have a Jquery accordion which works fine. Sections get expanded/collapsed when clicked on respective headers. But I want to add the functionality so that when I click on "next" button it opens up the next section and clicking "Previous" button takes me back to previous section. This has been done on this page http://jquery.bassi...

Iframe url question for the experts

Hi There, I was hoping that someone can help me, I am trying to get the URL of a page in a iframe: <script language="JavaScript"> function myLocation() { alert(document.all.myFrame.contentWindow.location); } </script> <button onclick="myLocation();">Location of Frame</button> <iframe src="http://www.google.com" width="...

JSON result containing only one item

I'm likely missing something with json and javascript. [{"commentText":"Testing 123","userPosted":"maxfridbe"}, {"commentText":"Testing 23","userPosted":"maxfridbe"}] Sometimes I get multiple responses which works with this code: function(data) { var sel = this; jQuery.each(data, fun...

.NET Equivalent to DateJS

I like the different human readable strings you can parse with the DateJS javascript project (http://www.datejs.com/). I was wondering if anyone knew of any .NET library that could parse simiilar strings in .NET? ...

Javascript -> Flash throwing "Error calling method on NPObject"

I'm trying to call a Flash (AS3) function from Javascript. When the code runs, I get the error "Error: uncaught exception: Error calling method on NPObject!" From my day's worth of googling around, this seems to be be a security matter, and I've done everything I can find, but the error still comes up. Some details: * This happens wit...

Javascript max() function for 3 numbers

I need to find the highest number from 3 different numbers. The only thing I've found is max() but you can only use 2 numbers. Whats the best way? ...

How can i store a bunch of jquery commands in a function that i can call with click event.

Currently i have this: $(".splitCol").click(function () { $.cookie('whichColumn', 'split'); $(".threeCol .active").removeClass("active"); $(".leftCol .active").removeClass("active"); $(".splitCol span").addClass("active"); $(".threeColumns li:eq(3)").removeClass("first"); $(".threeColumns li:eq(6)").remo...

Dynamic CSS and Javascript

How does one create Dynamic CSS and JavaScript On-The-Fly (using PHP). This needs to be done as different pages have different set of elements sometimes, so wrapping and sending a large CSS/JS everytime would be overkill. And why do many sites have link tags like this: <link rel='stylesheet' type='text/css' href='css/style.css?pg_id=43&...

jQuery load() from within ajaxComplete() callback causing multiple loads

Hello, I've been staring at this one for a while and I'm completely stumped. You'll need firebug for this, take a look at the AJAX requests. They seem to be multiplying after each click of next and previous, until it's too slow to load entirely: http://www.ftsdev.com/freegreen/virtual-tour-prototype/virtual-tour.html All the JavaScrip...

Fancy Upload without file browser

Is there a way to pass a list of files to fancy upload via java script rather then using the browse button and dialog? http://digitarald.de/project/fancyupload/#docs Thanks in advance. ...

jQuery not working in AJAX Loaded page

I am using jQuery to load a page by AJAX using $.ajax (suppose test.html).Its a simple HTML document with a few buttons and associated animations upon clicking them (also using jQuery).The .click() properties associated are working fine when I load the page directly but the buttons fail to respond when I click them in the AJAX loaded ver...

Function not defined javascript

For some reason my javascript code is messed up. When run through firebug, I get the error "proceedToSecond not defined". But it is defined! please help <script type = "text/javascript"> function proceedToSecond () { document.getElementById("div1").style.visibility="hidden"; document.getElementById("div2").style.visibility="vi...

Are Interfaces in JavaScript necessary?

I suppose this could apply to any dynamic language, but the one I'm using is JavaScript. We have a situation where we're writing a couple of controls in JavaScript that need to expose a Send() function which is then called by the page that hosts the JavaScript. We have an array of objects that have this Send function defined so we iterat...

jQuery framework internals

Hi I am trying to understand the internals of how jquery framework is written and finding it hard to understand the code. Does anyone have any suggestions regarding a good way to get started. Thanks for all the useful input. Editing the topic since I had limited space for adding individual comments. I have written a lot of basic java...

Javascript complex array "element reduction" - building an HTML table based on array elements

I have a project that requires the following. Four arrays will be declared in the code as such: var ROW1 = ['module1']; var ROW2 = ['module2', 'module3']; var ROW3 = ['module4', 'module5', 'module6']; var ROW4 = ['module7', 'module8']; Each element of these arrays represents a module in a configurable HTML widget. Based on what eleme...