javascript

Variables set during $.getJSON function only accessible within function

This may be more of a scoping question. I'm trying to set a JSON object within a $.getJSON function, but I need to be able to use that object outside of the callback. var jsonIssues = {}; // declare json variable $.getJSON("url", function(data) { jsonIssues = data.Issues; }); // jsonIssues not accessible here A similar question...

How do I submit a form to JavaScript without the submit button?

<form> <input type="text" name="sometext"> <input type="button" value="Send" onClick="sendsometext(this.form);"> </form> How would that be without using the submit button (I don't want it at all), just submitting the form by pressing the Enter key. EDITED: I don't want to submit the form at all. I just want to type some text in ...

google map api v3 geocode callback function

hi, i m using google map api v3 , geocode service. here i m sending latitude and longitude of any location and getting it's address. i want to store it into a global variable and want to return it to the caller. i m calling this script function from vb.net 2005 webbrowser control. so can any one suggest me that how it will return a ...

jQuery undefined error using FancyBox

I am using this http://fancybox.net/ When I do $('a.#div1').trigger('click') to popup a fancybox, it gives me this error (using Firebug) opts.itemArray[opts.itemCurrent] is undefined if (opts.itemArray[opts.itemCurren...[opts.itemCurrent].title.length > 0) {\r\n jquery.f...-1.2.1.js (line 345) Why is that? Can you help? Thanks. ...

Dynamically populating HTML DropDown controls using AJAX and PHP.

To dynamically fill DropDown controls on my HTML Form, I have written code that makes AJAX call to a .php file. This .php file populates the DropDown control with a single column value. In this whole process, three files play the role. (1) A HTML file that contains the entry form, (2) A .js file containing basic AJAX code, and (3) A .p...

basic javascript question: after 5 seconds, set variable to true.

Im basically trying to accomplish the following. I want it so 5 seconds after the page loads, it'll set the variable to true. Once true, it'll proceed to give the alert "true".. for now. If someone tries to click the button before 5 seconds, it'll give the alert false. Here's what i managed to type up. Isn't exactly working. Thanks :)...

javascript question on inheritance and prototypes

In the jQuery library, I found this line jQuery.extend = jQuery.fn.extend = function() { This kind of puzzles me. I thought that a given object automatically provides access to its prototype methods (in other words, if a method, or var, is not resolved on the object itself, it is tried on its prototype, then on the prototype's prototy...

How do we retrieve the pattern subset using regular expression in javascript?

<script type='text/javascript'> var str="('apple',16),('orange',7),('banana',12)"; var pattern=/\('([^']+)',([0-9]+)\)/gi; var reg=new RegExp(pattern); var arr=str.match(reg); document.write(arr); </script> In the above javascript, I used two pairs of brackets in the pattern to indicate the data I want to get from the string. Obvio...

Open popup and poulate it with data from parent window?

How can I use Javascript/jQuery to populate a popup-window with data from JS-variables in the parent page? In my example I have an array of filenames. I list at most five in the parent window and if there's more I want to provide a link that opens a popup window and lists each post in the array. So if I open a popup that contains a <ul...

file manager with role based permission

Hi, I m a beginner to PHP and MySQL, I am having 3 user roles in my project: manager editor mtuser Managers account can upload files to the system. Editors and mtusers are able to download file uploaded by a manager, they can modify those and reupload back to managers (feedback). I am using a temp directory to store those files on...

use js to store current domain, full url, and ip

Im trying to obtain the IP address of the user, current domain, and full page URL when my javascript is run ( for traffic analysis ) var ip = '<!--#echo var="REMOTE_ADDR"-->'; var domain = document.domain; var page = window.location; I keep getting errors in FF3 Error: uncaught exception: [Exception... "Component returned failu...

decimal places in JS

I have two form inputs which display the calculated invoice subtotal and total of a form. The problem I'm having is it's not displaying 2 decimal places. Subtotal function function calcProdSubTotal() { var prodSubTotal = 0; $(".row-total-input").each(function(){ var valString = $(this).val() || 0; prodS...

How do i dynamically adding controls in asp.net with JavaScript or JQuery.

I have a field with a 1:N relationship with some other fields. I need the user to specifier how many elements are related to that particular field to enable me create the right amount of controls dynamically through JavaScript of JQuery. I dont want to have the user enter the data repeatedly. How can i create these controls please? ...

What's the event fired when user selects some text on the page?

Either by double click or move the mouse. Anyone knows about this? ...

jQuery design mistake or historical reason ?

Today is jQuery day. I found this in the documentation: blur() Returns: jQuery Triggers the blur event of each matched element. blur(fn) Returns: jQuery Bind a function to the blur event of each matched element. In other words, the behavior of the function is totally different depending if it accepts or not an a...

calling a function

I made a database, I am printing my required field in a marquee. Now i want that if (change>0); print (image_21); else print (image_2); This is the code I am using: <%@page import="java.sql.*" %> <html> <head> <meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> <title>JSP Page</title> <...

Scope with a self-invoking function in Javascript

Take below code iterates over 6 input buttons and attaches an onclick event to every button that alerts the index number of the respective iteration: for (var i = 1; i < 6; ++i) { var but = document.getElementById('b_' + i); (function (el) { var num = i; but.onclick = function () { alert(num); ...

GWT check if flash is installed

Is there a way in GWT to check if the browser running is supporting Flash? ...

Simple JavaScript Timer: substring or datetime?

Hi guys, I have a label with a format ever should be: "00:00:00". This timer should be count down via JavaScript, when the timer is 0, there should be a "Ended" in the label. So how do it with the less performence (e.g.: I have a site with 50 timers, they need to be synchron). My idea is to split this via substring and -1 them, check...

Getting AJAX content into the DOM or registering an object with jQuery via an onClick event?

I have a code setup something like below, the image is part of a block of HTML and is being loaded with AJAX so I can't get a direct handle on it using it's class or id, so I'm passing the object into a function and then picking it up with jQuery from there. I don't like this method, is there any way of registering the image (or prefera...