javascript

How to carry "getjson" functionality from one func to another?

Basically I have a getjson call to call for a bunch load of data. Now I am getting sick of the amount of if data is null else checks. For Example: if (data.Height == "") { $('#DataHeight').html('No Data is Available'); } else { $('#DataHeight').html(data.Height); } Reason being ...

Javascript access another webpage

I know very, very little of javascript, but I'm interested in writing a script which needs information from another webpage. It there a javascript equivalent of something like urllib2? It doesn't need to be very robust, just enough to process a simple GET request, no need to store cookies or anything and store the results. ...

Changing HTML DOM element name dynamically

What I'm thinking about is when I remove or add a child element from the DOM, I will change other elements' names through JavaScript or jQuery. For example, I'm going to remove the second text box from a form which have 3 text boxes. They have the names "input-1", "input-2" and "input-3." After removing "input-2," I'm going to rename ...

Duplex with Javascript? (and flash?)

Is there a solution to duplex data with javascript? I dont mind if flash is used. All i need to send and receive text. The solution must work with FireFox 3.6+. ...

I want to make a map of the world, with people hitting my site as sparks. What's the best way to do this?

Whenever someone hits my site in NY, I want that map to show a spark in NY (then disappear). So, there will be sparks all over the map, as people hit my site. Is it possible to NOT use Google Maps to do this, with a nicer-looking background map? I'm not allowed to use Google maps. ...

xhr.send(file) doesn't post it as multipart

On Firefox 3.6 and Chrome, using xhr.send(file) just puts the raw contents into the body of the request and it is not a true multipart/form-data upload. Tried doing this: http://kaply.com/weblog/2010/05/20/post-multipart-form-xhr/ But, can't really mix string with File contents during send(). Any workarounds? ...

For loop in jQuery

Need to run a for loop in jquery. Condition is : i have the following code <div id="container"> <ul> <li style="background-color:#CCC">First</li> <li style="background-color:#CCC">Second</li> <li style="background-color:#CCC">Third</li> <li style="background-color:#CCC">Fourth</li> <li style="background-color:#999...

calculate the interval duration of a tape using javascript?

I have to calculate the interval from time duration in javascript. ie, if 100:56:56 to 101:00:00, then duration is 0 hr 3 mins 4 secs . How to do this in javasript? ...

Html 'Select' control always returnh selected index as 0

I have placed HTML 'Select' control on aspx page and it's items(options) are loaded dynamically using javasvript. The items in dropdown appear properly on web page. But when I select any item from dropdown, it's selected index is not returned in aspx.cs file. In fact, it shows selected index as 0 and size of 'Select' html control as -1. ...

In javascript how to find the height and width.

Hi, i am having a .aspx and masterpage page. in masterpage i am loading aspx page . in aspx page design i am using generating table structure using code-behind server in javascript how to find the height and width . Regards, kumar ...

How can I get break on runtime exception(or error) in javascript (or ecmascript?)

How can I break on error? I have a code: throw new Error("Some error"); And I'm using most recent version of Web Inspector (Webkit) and Firebug(Mozilla). These tools catch and print the error, but does not break. May I don't know the how to. Please let me know how can I to do these? ...

Jquery event for changing an element's class attribute

I need to execute a JQuery code when an element's class attribute is changed. For example, initially the element will be : <div class="my-class">. So, when a new class is added to this div, (i.e. <div class="my-class new-class">, I have to trigger a JQuery code. How do I do this in JQuery? Is there event for attribute change? ...

Protect jQuery function from outside access

I'm using jQuery in an app which registers user clicks to perform a given action through the .click() binding, and I want this functionality to be available only through a user mousedown. One of my friends pointed out today that it's possible to run $(element).click() from a javascript terminal in Firebug (or something similar), and achi...

Cufon: Underline Text

How can I underline a text replaced with Cufon? ...

is there any way to assign variable for css claas name?

I am looking to assign variable names to css class dynamically. Here im explaining with small code #A1, #A2, #A3, #A4{ float: left; clear: left; width: 300px; margin: 15px; } instead of writing " #A1, #A2, #A3, #A4" , i want to write some variable. with for loop i want to define four classes while page is getting loaded. ...

Using JS, How Can I integrate bit.ly URL shorten with Twitter @anywhere tweetbox?

@anywhere from twitter is a great Javascript only solution. But it seems I couldn't integrate bitly api with @anywhere tweetbox. Tweetbox of @anywhere can have default strings to show up in textarea where you can tweet. I am using bitly api to shorten url right now, but I can't figure out how to pass that shortened url to tweetbox. ...

Extracting number ID from a URL in Javascript

Similar to my previous question: http://stackoverflow.com/questions/3300433/spliting-a-string-in-javascript The URLs have now changed and the unique number ID is no longer at the end of the URL like so: /MarketUpdate/Pricing/9352730/Report How would i extract the number from this now i cannot use the previous solution? ...

calling remote cakephp folder in my iframe.html file ?

Hi, Currently i am working on div based remote page calling method means i have to call another file in my div actually i have 1 buttons as button when i clicked on that it has url for replacing currently opened page by another . I am working on cakephp and in localhost i have simple iframe.html in htdocs and song folder(in cakephp) ...

Preserve text selection in contenteditable while interacting with jQuery UI Dialog and text input.

I have a jQuery dialog for making links in a contentEditable span. The problem is that clicking a button to open the dialog causes the selection to be lost, text input inside the dialog also causes the selection to be lost. I can fix the button with -moz-user-select:none; but -webkit-user-select:none doesn't work in Chrome. I can fix t...

Is the downside of coding styles (css) in jQuery genuinely prohibitive?

I was just reading an article about the non-compatibility of some CSS, when it occurred to me that maybe I should be writing all of my CSS in jQuery. Aside from javascript-disabled browsers, which any ajax website isn't going to support anyway, what's the downside? The benefit, aside from greater browser support, would be the use of var...