javascript

Setting -webkit-gradient backgrounds via jQuery doesn't work

Defining gradients in CSS works fine, but when I try to do this with jQuery, nothing changes. Typing $('#header').css({background: '-webkit-gradient(linear, 0% 0%, 100% 100%, from(#cfc), to(#afa)'}); in Chrome's (4.0.249.43, Linux) JS console (in page's script tag too) really does nothing (but returns jQuery object, so it's valid). Tr...

What would be your take on Doctype version detection?

What would be your take on Doctype version detection. One solution comes to mind – feature detection, but is that the correct way to go? What I need in particular is to know wether the document is HTML4, XHTML (don't need the version) or HTML5. Ideas? ...

Detect browser's default search engine in Javascript

I'm writing a piece of code for a Chrome+Firefox extension that redirects users to a search results page for a given string. Currently we redirect to the google search results, and instead of building our own option for search engines, I was wondering if there is a way to use whatever search engine the browser is set to use. I was wonde...

Tools to capture executing javascript code

Is there any tool to capture executing and executed javascript code on client side? We use debugger command to step through on dev machines but to debug production issues is there any tool that captures loaded and executing javascript code? Any guidance is much appreciated. thanks ...

Will I be able to get a list of registered event handlers on a DOM node inside a firefox extension?

I don't know a thing about implementing extensions in Firefox, but having not seen an extension that does anything like this in the Mozilla's addons page, I don't believe it is possible, but thought I will ask about it anway. ...

How to call two functions on single event. one as a javascript function other a server side function.

I want to call two functions on same event 1 is client side and other 1 is server side. How can i do that <input type="text" ID="txtUserName" runat="server" maxlength="50" class="DefaultTextbox" style="width:180px;" value="" onfocus="ControlOnFocus('', this, spanUserName);" ...

What does the i--> opeator do in JavaScript?

So I took a look at the code that controls the counter on the SO advertising page. Then I saw the line where this occured i-->. What does this do? Here is the full code: $(function(){ var visitors = 5373891; var updateVisitors = function() { visitors++; var vs = visitors.toString(), ...

JavaScript DELETE statement. Query

I was just wondering if the DELETE statement is supported by all browsers e.g: delete myObj; I just want to make 100% sure if all browsers support this or not? Also is there any browser or maybe mobile (cell) phones that do not? The more information the better... ...

Django : View returns JSON content_dictionary, how to decode in Javascript

Let me explain what I'm trying to do, and if someone could point the correct way to do it & a solution to where I'm stuck that would be great ! Someone types url www.ABC.com/showItem/Blackberry I lookup "Blackberry" in my database and find data for it, now I want to show its details one a page. Hence in the View I do this return_dat...

Using window.name as a local data cache in web browsers

I was reading about cookies and other related client-side storage options, and read about using window.name as a data cache of sorts: http://en.wikipedia.org/wiki/HTTP_cookie#window.name While it certainly has things that make it less desirable - and I won't sugar coat it, it is definitely a hack in the most true sense of that word - i...

Javascript add class and keep original

Im using the following: url=location.href fname=url.match(/.*\/(.*)\./)[1] document.body.className=fname This takes part of the URL and adds a class to the <body> tag with the text extracted from the URL. However the problem with this method is the class only gets applied providing doesnt already have a class assigned. Im really l...

Symfony Javascript Form Validation

Hey, So I have a form on my website that will submit a name and email address. I want to submit them with ajax which is simple to do, but I wanted to verify that both fields are filled in and that the email is in the correct email form. Basically I want to run some client side validation on the fields before submitting it via ajax. Do...

PHP content caching for javascript and css

I have a unique problem, which is proving difficult to solve using google. I am consolidating all of my javascript and css into separate php files, which use require_once() to pull the contents of the files in. The javascript file looks something like this: <?php header('Content-Type: text/javascript'); require_once('jquery.form.js'); r...

severside processing vs client side processing + ajax?

looking for some general advice and/or thoughts... i'm creating what i think to be more of a web application then web page, because i intend it to be like a gmail app where you would leave the page open all day long while getting updates "pushed" to the page (for the interested i'm using the comet programming technique). i've never cr...

Javascript: Force a reload from the server, how?

Hello all, I just found a snippet of code today as I need to refresh a page of mine so that a PHP script can run again to show new results from the DB every minute or so. if (document.images) setTimeout('location.reload(true)',1000*60*15); // forces a reload from the server else setTimeout('location.href = location.href',1000*6...

Run functions on elements with a certain class as soon as the DOM is loaded, not using an event handler

I have a simple function which I want to run on all elements with a certain class. I want this function to be run as soon as the DOM is loaded; not upon an event handler. Below is the code that will run on an event handler like hover. How do I make it run as soon as the DOM is loaded? $(document).ready(function(){ var displayname ...

Strange class behaviour; Gets applied to drop list option when it shouldn't...

This is kindof hard to explain... I have this class: .nav_option_main { background-color: #FC9; } I have two drop-lists, let's call them Drp1 and Drp2. Drp2 is populated depending on Drp1:s value, using javascript. Some values in Drp2 has the above class applied to them, but only some. Now, here is the strange problem, lets say...

When is JavaScript synchronous?

I have been under the impression for that JavaScript was always asynchronous. However, I have learned that there are situations where it is not (ie DOM manipulations). Is there a good reference anywhere about when it will be synchronous and when it will be asynchronous? Does jQuery affect this at all? ...

jquery hover effect

How can I get same effect like this http://bavotasan.com/demos/fadehover/ But only for anchor tags not for images, let say I have anchor background blue and I want it to change to red but with this effect, how can I do that? thank you ...

How to use JavaScript to provide users with multiple options of types of data to enter

I currently have a page that allows a user to enter different types of database entries via a select("questions" for a survey), i.e. Multiple Choice, Text, Drop-down, etc. Right now this is done using the following code: <form enctype="multipart/form-data" action="" method="POST" id='mainform'> <!-- Multiple Choice Div --> <div id="mc"...