javascript

Return boolean value through multiple functions

I have some Javascript code that needs to end with either a true or false value being returned. However, when the true/false value is computed, the original value has passed through multiple functions, like so: var txt = 'foo' function one(txt) { if(txt == 'foo') { two(txt); } } function two(txt) { if(txt == 'foo') { three(txt); } }...

YUI3 Tabview Initialization

I'm trying to setup a simple tabview from existing markup, ala this example from the YUI developer network. Works like a charm. However, my question is, how do you designate which of the tabs should be initially selected? Can it be done via the existing markup, or is the only way via javascript? This isn't really addressed in the example...

Horizontal Scrolling Using SlickGrid

does slickgrid support horizontal scrolling? instead of a vertical list of items, use horizontal list of items like itunes coverflow or carousel. ...

problem with iterating through the JSON object

In the code below, I tried iterating over the JSON object string. However, I do not get the desired output. My output on the webpage looks something like:- +item.temperature++item.temperature++item.temperature++item.temperature+ The alert that outputs the temperature works well. The part where I try accessing the value by iterating thr...

disable/enable right click on a particular part of the html body

i want to disable right click on the webpage but i want enable right click on textarea. Hey wat is this provide answers dont post lot of comments on right click (lol). i dont care if people would see my source code, thats nt the point ... i just want to know how one can enable right click only in the textarea while disabling the rest so...

Writing a simple custom read more on click function for jquery that needs refactoring

I want to be able to reuse the same function many times on one page.. So here's some psuedo-code : $(".read_more").click(function(){ $(this).parents().find(".hidden_text").slideToggle("fast") }); The problem with this code, however, is that it targets every elem on the page matching .hidden_text. Is there a way to combine closest() w...

A reasonable number of simultaneous, asynchronous ajax requests

I'm wondering what the consensus is on how many simultaneous asynchronous ajax requests is generally allowable. The reason I ask, is I'm working on a personal web app. For the most part I keep my requests down to one. However there are a few situations where I send up to 4 requests simultaneously. This causes a bit of delay, as the ...

jQuery Optimization/Best Practices

Ok saddle up cowboys, because this is going to be a long one. I have been spending the morning going through some of my old code and I'm left wondering about best practices and optimzation. In order to avoid a ride down subjective lane I'll just post some examples with some hopefully easy to answer questions. I will try to keep the examp...

JQuery page jumping to the top of the page

I am using this Jquery and it works great The problem is when i click on the button the page jumps all the way to the top. I am using Miva if that makes a difference $(document).ready(function(){ $('.drop').click(function(){ var $next = $(this).parent().next('li.drop_down'); if($next.is(':visible')) { ...

How to italicize a word being displayed by a web.sitemap

I have a company name that always needs to be italicized. I have navigation that is driven by my sitemap and I can not figure out how to italicize the word. The word is always the same, so I thought about some Jscript, but was wondering if I had any other options. Thank You. ...

How to assign a link to a div and have it open in a new window

I have my click function set up to look for the first link in the div and assign that link to the entire div. $('.article-excerpt').click(function() { var newLink = $(this).find('a:first-child').attr("href"); if(newLink != "" && newLink != "#") { window.location.href = newLink; } return false; }); How can I also make that link...

'Permission Denied' when trying to make Jquery $.ajax request

function populateGroups(){ var p =1; var groupNames = new Array(); $.ajax({ type: "GET", url: "http://okcmonprd103/iMon/findgroups.pl", dataType: "text/xml", success: function parseGroupNames(xml){ $(xml).find('group').each(function(){ groupNames[p] = $(this).find('name').text(); ...

jQuery :not and :first ordering

Hi all, I am trying to get the first input field in a form that isn't disabled or hidden. I need to be able to exclude radio buttons, selects, and particular IDs. The following code works perfectly, EXCEPT when a select comes before the text or password field that I want: $("form :input:visible:enabled:first:not('select')"); If I exc...

ASP form action file (FileSystemObject)

Hey, I've got my code to post a javascript array in a form: <form id="my_form" action="file:///C:/Users/John/Desktop/jquery/savetext.aspx" method="post" onsubmit="return prepare()"> <input type="text" id="file_name" name="file_name" rows="1" cols="20" /> <input type="hidden" name="seatsArray" /> <input type="submit" value="Save" /> </f...

Javascript: "use strict"

Possible Duplicate: Which (javascript) environments support ECMAscript 5 strict mode? (aka use strict) Which browsers have implemented ECMAScript 5's strict mode (via "use strict")? ...

Need help understanding Javascript's .match method

Hello all, I understand that .match() returns an array of the matches, or null if none are found. But how do I go about accessing the values of capturing groups used with .match? For example: var val = whatever.match('(?:^|;) ?' + stuff + '=([^;]*)(?:;|$)'); Assuming the regular expression matches more than once, how do I access th...

Announcing the length of an Array

var names=new Array("Charlie","Auggie","Hunter","Diesel","Harlum","Tank","Runt"); var rnames=Math.floor(Math.random(1,names.length)); That is my code, rnames is always 0. How would I tell the length of a table? (the length is 7 - in other words, i want to tell how many entries are inside of a table.) ...

How multiple select to create a new row?

I have this code: <select name="team[]" size="8" multiple="multiple">$team</select> It lists for example players in that team, I want when user clicks on player it creates a new row where I can input basic info about player which I will add to database via php. ...

How to complete $.get() when a form is submitted using jQuery

I am using a third party shopping cart that sends a registration form to a .cgi script. I want to send information from that form to me, and the customer via a jQuery $.get() function call. The $.get calls a registration.mail.php script. The problem is that the form submitting seems to cancel out the ajax call before the ajax call can...

Why is image preloading ineffective?

My CMS project has a stylish web 2.0 login screen that fades over the screen using javascript. How come that even though I have made 120% sure that images are preloaded (I used the resource monitor in development tools) they still take a second to show up when my login screen appears. It completely destroys the fanciness! Take a look: h...