javascript

How do I share jQuery script between pages?

Hi folks, what is the best way to share jQuery code between pages? this is the situation: -------SITUATION--------- I have several different pages that goes this way (pseudo code) <% render "content/link" , collection => required_links %> In the "content/link" partial <div class="element_to_be_changed"/> Currently in EVERY PAGE...

Changing DIV color without giving an ID ?

Hi all. I have the following code : <div id="wrapper"> <div style="width:500px;background-color:yellow;"> // this is a parent div <div style="width:260px;"> <a href="javascript:XXXXX">Click me to color only the FIRST yellow div</a> </div> </div> <div style="width:500px;background-color:yellow;"> // this is a paren...

Why does my if condition prevent either clause from executing?

I'm trying to re-write the URLs of a set of links that I select using a jQuery class selector. However, I only wish to re-write the links that don't already have a href attribute specified, so I put in an if/else construct to check for this... However, it's not working. It does work without the if else statement so I'm pretty sure that i...

Using native code functions as JavaScript objects in WebKit

I'm unable to use native code functions as JavaScript objects in WebKit-based browsers. Is it impossible to alias these functions directly? This is easiest to explain by example, so here is what I am running in the Developer Tools console: console.warn; // Outputs: // function warn() { // [native code] // } console.warn("console....

Why isn't this function executing?

I'm having an annoying problem which I have asked some questions about already, now I finally tracked it down, and I think I'm close to a solution, with your help of course. I have two JavaScript files, both using jQuery, but only one of them are running. The one working starts with "$(document).ready(function() {.." and works just fine...

Retrieving file name with Javascript (without URL?)

I need to retrieve the file name of an HTM file - the file needs to retrieve its own file name - to use in another Javascript function within the same file. So far I have - var Docname = "ESSA_CL_2009_01" var DSstem = new Spry.Data.XMLDataSet("ESSA10_DA_sourceData_19_1.xml", "ESSA_CL_2009/" + Docname + "/Item_stem"); (the Spry or AJAX...

jquery and input text

Hi everyone, I would know if this is a bug... When I alert html content from #test, I get : <input name="sum" value="" type="text"> whereas it was set to 55 just before the alert, and I can view it on the brower. Can you tell me why ? :-) <div id="test"> <input type="text" name="sum" value=""> </div> <script language="java...

How do I change JAVASCRIPT_DEFAULT_SOURCES for my application?

When you call javascript_include_tag :defaults you usually get: prototype.js, effects.js, dragdrop.js, and controls.js. These are stored in a constant in ActionView::Helpers::AssetTagHelper called 'JAVASCRIPT_DEFAULT_SOURCES`. My application uses jQuery, so I want to replace the Prototype references with something more useful. I added ...

Programatically access webpage error details in browsers

Is there some way to access webpage warning/error details using JavaScript? For instance, errors in IE show up in the bottom left corner like so: I would like to able to access the details of this error (in IE as well as other browsers if possible) using JavaScript. Any suggestions? EDIT: I'm not looking for debuggers. I want to a...

Open an overlay while nextpage is loading

Trying to open an overlay (with JqueryTools) with loading message before the page changes, can't find how to use the href attribute of my trigger (i'm using a class .btn_menu for multiple button) HTML <div class='btn_menu'> <a class='modalInput' rel='#loading' href="a_mailling.php"></a> </div> JS $(function() { var triggers ...

jQuery animations not working on iPhone

Hi everyone, I'm using jQuery on a client's vCard site - http://chrismward.com/beta - to switch between pages. It all works great on the computer, but when I try on my iPhone: no dice. I'm using jQuery 4.0 and here is the only js file I'm using on the site (other than jQuery from the Google CDN) - http://chrismward.com/beta/resource/...

What's the most reliable way of getting a page's referrer in IE?

From within a browser extension (BHO) I want to know the URL that referred a user to the current page. I thought I could just get the document.referrer, but I find that's blank if links are opened in a new window. Is this just tough bikkies or can I use opener.location.href in some cases, or something else? As a follow-up, I'm currently...

Parse query string in JavaScript

I need to parse the query string www.mysite.com/default.aspx?dest=aboutus.aspx. How do I get the dest variable in JavaScript? ...

Canvas fillText performance, is it my code or a problem with WebKit?

I'm implementing some basic animations in canvas, when I came across an interesting issue. It appears that Firefox is rendering my text much more smoothly when animated, then the Chrome or WebKit nightlies. Is this a problem with my code or is there a performance issue with fillText in Webkit/Chrome? edit I forgot to mention in my actu...

Why was JavaScript Implemented Using Prototypal Inheritance?

There's lots of articles and posts explaining how JavaScript inheritance works, but I'm curious why JavaScript was implemented using prototypal inheritance instead of classical inheritance. I love JavaScript so I'm not saying it's bad thing... I'm just curious. ...

How do I switch external css files with ajax?

I've got a couple books that I'm reading on ajax, but still quite new. All the tutorials and these books have the ubiquitous examples of: an auto-populating search bar and an asynchronous form validator. Those are both great, but not what I'm looking for. Specifically, I'm wanting to click a button and switch the external css file in ...

JQUERY, Warning Users that IE6 Is Not Supported are wanted

Hello, I'm building an app and have no intentions of support IE6 at this time. To be fair to IE6, I want IE6 users to know that and not think the app was made by incompetent developers. I was hoping a JQUERY Plug-In would be available that would provide a nice StackOverflow style alert at the top of the page, plug & play and I'm done. ...

how to check the textarea content is blank using javascript ?

using value.lenght != 0 ..doesn't work for the blank space situation ...

Secure a PHP file

I have a PHP file i made that basically give me passwords to all my users. I want to be the only one able to view the contents and see the page. Whats the best way doing it? Password protection? Requiring a special cookie that only I have? Give me some ideas.. ...

i ajax a file with jquery,and i don't know where does it download to.

$.ajax({ type: "POST", url: "http://images.digu.com/web_res_v1/images/logo.png?t=20091230", success: function(msg){ alert( "Data Saved: " + msg ); } }); where is the download file. thanks ...