javascript

JavaScript field Inheritance weird behaviour.

function A(){ this.a = {}; this.b = 0; this.Test = function(value){ this.a.x = value; this.b = value; }; } function B(){} B.prototype = new A; var b1= (new B()); b1.Test(1); var b2= (new B()); b2.Test(2); log(b1.b == 1); //true log(b2.b == 2); //true log(b1.a.x == 1);//false ...

How to find out if ipad is in landscape/portrait mode in javascript/jquery?

I want to add an extra div if the ipad is in landscape mode. Is there some sort of if statement that could find this out? Thanks ...

Passing parameters in Javascript onClick event

Hi I'm trying to pass a parameter in the onclick event. Below is a sample code: <div id="div"></div> <script language="javascript" type="text/javascript"> var div = document.getElementById('div'); for (var i = 0; i < 10; i++) { var link = document.createElement('a'); link.setAttribute('href', '#'); link.inn...

Compare array of words to a textarea input with javascript

I have a textarea inside a form. Before the form is submitted, the textarea is validated and checked so it is not empty, not over 2000 characters, not contain forbidden characters etc... I am working on the last part of the validation, which would need the textarea to be compared to an array of "bad words". This to help me maintain an...

Edit serverside files in JS.

Hello guys, i am making some script for some personal use. Now i tend to keep my CD collection list in a html file which has some sleek design, but i am tired of editing the list by "hand" and that means that i don't want to edit the code everytime i add new CD. So is there a way that i can use JS or JQuery so i could add/read from a loc...

Matching local javascript file to remote file for debugging in visual studio

I am working on a project in which javascript files are dynamically loaded into a page by the server using a python script. I am trying to use visual studio to debug these javascript files by attaching to the appropriate IE process for the loaded page and using the script debugger. The problem is that IE and Visual Studio identify the ...

IE6-7 error with jquery

IE6 and 7 return a js error "expected identifier, string or number" on this : function fadeopacity (){ var opacity = $("#pics_list > li:first").css("opacity"); $("#pics_list > li").hover( function () { $(this).stop().animate({ opacity: 1, }, 300, null)}, ->this is the l...

Set div scrollbar to specific position

Hello, I am using this javascript (Super Table) to transform my table in a div to freeze the top header and left column. The scrollable area has columns with textboxes that corrospond to a specific month and year. I would like to have the horizontal scroll position to match the current month and year. I create the table programmatically...

Cross domain application integration?

My company has a Java webapp that contains a product catalog feature. We are looking for a way to integrate the catalog into other sites in a way that no server side code would need to be written(on the external sites). I'm just looking for suggestions for ways that one might go about doing something like this... ? ...

how do i find near by locations to a given location using google map api

would like to find all the nearby places for a given place or address. Is there any google map api ? or we need to follow a sequence of steps like Find the lat long of the place. Do some processing and get near by lat longs. do reverse geo coding with the obtained lat longs from step 2 and find the places for each lat long pairs. cla...

Any way to make div scroll in ipad?

I have tried so many different things and I keep searching but I find nothing! Help anyone? ...

problem with jquery autocomplete and zend framework

I am trying to implement this tutorial in my application. I have managed to make it work until the point where I had to modify the view controller and add the link to the .ajax.html file. My code so far: class MenuController extends Zend_Controller_Action { public function init() { $this->_helper->ajaxContext()->a...

non javascript timer

Hey guys, I'm making a quiz with a limit, I want to keep track of the time left with something other than javascript, Because with javascript the user could simply pause the timer by disabling javascript, and take as much time as they need. and when they are done they could simply turn JS back on and submit the quiz. I'm using coldfusion...

Javascript Global Objects

Often I see a global object defined in javascript code to act as a namespace. var MyNS = {a: function() {}, ... }; But sometimes, I see people leave off the "var" keyword like MyNS = {a: function() {}, ...}; I believe in web browsers if you do not define a variable with var, it is put in the window object, which acts as a global na...

Jquery TextArea JSON and Illegal Character - most notably the £

I have a textarea, and am using $('#mytextarea').val(), and when i have text that is '£' i am getting the infamous black diamond with a question mark in it. �, When i package this up as a JSON packet it then gets sent to the server and it interprets it like this: "£" on the server side. I am sending it to the server with this code: j...

minimally invasive javascript tooltip utility (not a jQuery plug-in) needed

I want to use tooltips in my web app running in desktop and mobile touch browsers. To that end, I've written some touch-event code to generate a custom "linger" (pseudo-hover) event for touch. In touch devices, I want to display the tooltip when the user touches an element and lets her finger linger on it for ~500ms, like the tooltip on...

jQuery: html() returning empty string

If I use firebug and type $("<p>").html() into the watch window, I get an empty string back. My guess is because the $("<p>") hasn't been rendered to the document. How can I get the markup for $("<p>") before it's added to the DOM? ...

Can you embed the full YouTube player? Preferably via an API?

I've got this Chrome extension, and it uses jQuery to open a new Window with a YouTube video embedded in it. I do this with $('#movie_player').get(0).getVideoEmbedCode(); This works great, but you don't get all of the video controls, like quality selection, CC, etc. Is there a way to embed the full player? I would prefer to do it via ...

GWT "database" (client-side)

I'm looking for something like a database for GWT objects (inside the browser). It must work without HTML5 or Gears (or any browser plugins). It doesn't have to be capable of everything a database can do, but the most important features would be automated indexing, on multiple columns some kind of API or language to perform (a limited...

Specifying the value output of of an HTML5 input type = date?

I'd like to add native date pickers to my application, which currently uses a legacy, home-rolled system. Date input support isn't widespread, yet, but if I could present both implementations based on compatibility, that would be ideal. Is there any way to specify the output of the value given by an HTML datepicker? The default for oper...