javascript

Variable Global Scope understanding questions

Hey, my question is actually one of understanding - I have a working solution, I just don't understand how it works. Okay, so - what I'm trying to do is adding a setTimeout in a loop, and passing a changing value through it. Example: for (i=0;i<11;i++) { setTimeout("alert(i)",1000); } If I understood correctly, this doesnt work...

How to find the nearest common ancestors of two or more nodes ?

Hi, Users selects two or more elements in a HTML page. What i want to accomplish is to find those elements' common ancestors (so body node would be the common ancestor if none found before) ? P.S: It can be achieved with XPath but it is not a preferable option for me. Also it may be found with css selector parsing but i think it is a d...

Javascript timer counting down between two php dates

Hi All, I am building a timer for a website that will count down between two php date()s. The whole site uses php and there are a lot of time/date functions which rely on date_default_timezone_set() etc. So, back tot he timmer... I can get it working, well if I refresh my screen every second, the problem I currently have is the date/t...

datatables: json issue in webkit

Hello, This is my json returned: { "aaData": [["15/10/2010",".tv","All / Unidentified","Streaming","7","1.33","30%","0.4"], ["08/10/2010",".tv","All / Unidentified","Streaming","30","5.7","30%","1.71"], ["Total","","","","90","17.1","","5.13"],] } Which works fine in Firefox, its input into the table, however in Chrome and Safari I g...

Why would IE7 ask my approval( the user) when there is a window.prompt?

I have in my code a window.prompt, which should stop the flow of the code until user put in some value. Of course IE7 try to protect me from myself and instead of showing the prompt it shows the security tab (top of the page where it alerts to the users that a script wants to open a window). What is even worse is that the prompt is ignor...

any way to access data "loaded" via <script type=plaintext>

Im trying to load some code from an external domian with js. with script tags the browser is (according to firebug) loading the file. This is the code: $('<script type="plaintext"src="http://www.google.de"&gt;&lt;/sc'+'ript&gt;').appendTo('body'); You cann see after loading the content of the file in this case an html document in fire...

How to refer to the PlaceHolder in a masterpage, in my childpage using JavaScript ?

Hi All, This is my master page code <%@ Master Language="C#" AutoEventWireup="true" CodeBehind="SiteMaster.master.cs" Inherits="ChildPage_Call_Js_in_MasterPage.SiteMaster" %> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"&gt; <html xmlns="http://www.w3.org/...

change textarea value doesn't work

So, what i'm trying to do is adding a Javascript snippet in wordpress admin new post page, so that when i click a button it fills up the CONTENT textarea where the body of the post goes. Adding it is not a problem, i've already done this, but for some reason filling up the content field doesn't work. The textarea from the wordpress admi...

Disconnecting a Raphael element event

I attach an onmouseout event to a Raphael circle element like this: (function(el,iElPos,col){ el.mouseout(function elmouseout(){el.animate({"fill":col,"r":ELEMENT_RADIUS},150); alert("first"); fadeTag(); }); )(c,i,e...

jQuery: Modify the structure of an input.

Hi to all, i have wrote today because i need some help with a simple function in jquery for modify the structure of an input [reCaptcha] and hide the image showed. The code of the page(s) that contains the reCaptcha plugin is: http://pastebin.com/Qahph2ZB Is possible to make this in Jquery? BEFORE -----------------------------------...

Updating Html.Dropdownlists using JQuery

I found this solution on here http://stackoverflow.com/questions/2782815/how-to-update-strongly-typed-html-dropdownlist-using-jquery and am trying to implement it, but something is bugged in it. $(function() { $('#cid').change(function() { var selectedCompany = $(this).val(); var ddl = $("#foid"); $.post("/Ti...

conditional display of html element forms

Hello, Well, after a one hour introduction to javascript, I ve come up with the following code. It did what I wanted alright, but then I wanted something else and it wont work. I wanted that upon clicking on a button, a certain field would hide and on clicking on another yes, another one would hide too, BUT, of course, it had to make t...

Why jQuery.val( value ) does not dispatch any event from the DOM element?

When we use the method jQuery.Val( value ) over a DOM element to change its value. shouldn't the element dispatch an event informing that its value has changed? -I though the event 'change' was going to be dispatched. If it shouldn't why? Live Demo ...

I have built autocomplete input box (but there is a problem with foucsout)

I have built autocomplete input box (but there is a problem with foucsout) Watch this : http://www.youtube.com/watch?v=IxlXWfJsSeM Demo: http://www.faressoft.org/autocomplete/ My HTML Code : <div class="autoCompleteDiv"> <input type="text" value="" size="60" name="countryName" id="countryName" class="autocomplete"> <ul class=...

Mobile Device Usage

Where would I find usage statistics on mobile devices and browsers broken down by type over time? From a technical aspect I would like to support as many as I can in upcoming projects, however it would be beneficial to determine which devices / browsers are the pack leaders before I go supporting ancient junk. ...

Javascript as a general purpose language?

In a weekend geek seminar I attended, several instructors extolled the virtues of Javascript. I've used Javascript to some extent, but their enthusiasm caused me to want to step a little closer. I've learned bits-and-pieces about Rhino & SpiderMonkey. I know about server-side scripting & the restrictions placed on local file access (and...

Code Igniter Form - Javascript in PHP Variable. Not for the faint of heart...

Hello, This has got me in a pickle, though I'm sure it's probably fairly easy. I need to get the hash value from the parent window uri, and insert this into the set_value() function. Obviously I can't get a hash with PHP, so it has to be javascript. parent.location.hash works but I've no idea how to get it into set_value(). The fol...

How does the Javascript "this" operator deal with scopes?

Edit: I have to apologize, the problem I posted about actually does not exist in the code I posted, because I oversimplified it. I'll try to post something later. Deletion would also be ok, but there are too many answers at present, so I cannot do it myself. Edit2: Ok, here goes: Let, function F() { this.field = "value" ; v...

How to resrtict DIV jquery animation to container DIV..?

I have a page with a bunch of thumbnails. I use DIV with background images for the thumbnails. When I hover, I have a jQuery script that animates the DIV to expand the div to the full width of the images. The expansion is in all direction, it expands from the center with some margin and top/left positioning. Problem is: if I hover on ...

Async Google Analytics [Javascript Golf]

Unfortunately, this may not be a valid Code-Golf question as it is likely Javascript only; however, since this is likely to be the only useful-in-the-real-world code-golf contest I'm going to go ahead and post it. The Google Analytics Asyncronous Tracking snippet is used by many websites. The script goes a little something like this:...