javascript

triggering a jQuery function n seconds after the tab/window is in view

I am using jQuery to have a promotional window opening up -say- 5 seconds after a page is loaded. But the effect is lost for people who open the page in a new window or a new tab. When they get to my tab the window will already be open. Is there a way to get this to fire when people actually start viewing my site? I was thinking about ...

access object created by constructor using jquery

i have a jquery function that creates a dialog box from a regular javascript function for every element selected . one of the options i want to implement is to add buttons to the dialog box. these buttons would have the felxibility of having any function assigned to them. my problem is how to access the box in which the buttons are crea...

Binding AJAX data to html list template

I'd like a functionality such as binding that is in silverlight, but this works for html and ajax calls. I retrieve an array of the following objects from the server which is the user information whose class looks like the following: public class User{ public int UserId; public string ImgUrl; public string UserName; } If ...

Firefox and Flash change from firebug

I'm trying to write a Playlist for Flash Player. So I have problem with Flash & firefox. The playlist is HTML list where I have file urls for MP3. When I change from firebug object value the firefox doesn't react - disapears. Upd: I have object where I have parameters, when I change for example parameter where is written file path, the...

should all javascript go into a separate js file

What is the criteria if certain jquery or regular javascript should go inline or in a separate js file? ...

Generate random number in JavaScript

I need an 2d array [9,16] with 144 numbers from 1->36 in random order (so each number is repeated 4 times). I'm new at JS so can you give a hand, please. Thanks you. ...

jQuery - can I dynamically change an elements parent? A a new element and make it the parent of a selection?

Hi All, I have a div #someDiv, can I create a new element and make #someDiv be its child? Basically I want to wrap a new element aound #someDiv. How do I do this? $("#someDiv").appendTo($("<div id='newParent'></div>")); // The intent is to move #someDiv into the new container // The new container may or may not be in the same // posi...

Keep programmatically created html controls after postback

Hi, I am adding HTML input controls on the page dynamically via a "add text box" button but after post back eventually they are being washed away. Is there an easy and good practice which can help me keep the controls and their values after page post back. Thanks. Edit : I am using Javascript to create dynamic controls on the page I...

keyup Uppercase problem

I would like to have an input that would change to upper case on keyup. So I attach a simple event on keyup. HTML <input id="test"/> Javascript (with jQuery) $("#test").keyup(function(){ this.value = this.value.toUpperCase(); }); But I found that in Chrome and IE, when you push left arrow, the cursor automatically move to end. ...

How to pass the end of the URL to a Value="" in a form

I have a .htlm file on my hard drive is a list of my books and at the top there is a form and a script that allows me to search the content of the file. I like to access this file while I am browsing. I use Firefox with the extension "Advanced URL Builder" this extension allows me to highlight a few words and then using the context menu...

Serialize HTMLDocument and then rendering it in the server?

Hi, After some Google search, I did not find anything fill my need. I want to save the current web page just as what it is. I mean, many web pages has Javascript executed and CSS changed, so after some user interactive, the web page may be different from the one when it is firstly loaded into browser. And I want to save the current web...

problem with window.close and chrome

Im trying to close a child window with javascript and in firefox everything works fine but in chrome the window doesnt close here is what im using $(document).ready(function() { if (window.opener && !window.opener.closed) window.opener.location = "http://www.website.com" window.close(); }); I tried a suggestion on goo...

Regexp plurals - how?

I want to detect two versions of the same thing, plural and now eg: "piece" and "pieces" should both return a match. var re_1 = new RegExp("how many piece", "i"); or var re_1 = new RegExp("how many pieces", "i"); How do I form a RegExp expression in Javascript to detect both singular and plural in the same pattern? ...

can we get the list of all open urls in browser from java script.

Is it possible to get urls of all the tabs open in the browser from java script...Is it any browser dependent thing ? ...

Scope problem with SetTimeOut

I don't know why but this code is not working ? Why would it not ? I guess it is because scope problem I am having here : function washAway(obj) { alert($(obj)); // says HTML Object which is fine setTimeout(function() { alert($(obj)); // says undefined $(obj).fadeOut("slow", function() { ...

Jquery - waiting for user input

im trying to make a popup that comes up to confirm a users action (deleting a row in a table, for example..). aiming at making the popup entirely HTML and Javascript. What i can't get my head around is how i would make the javascript wait for the users input, but still function for other javascript events. (other click triggered stuff, e...

Why PHP is not showing exception?

I am using following code. When the query crashes, it is not displaying the ALERT that I defined in the "catch" block. <?php error_reporting(E_ALL ^ E_NOTICE); require_once("../Lib/dbaccess.php"); //Retrieve values from Input Form $CategoryName = $_POST["inCategory"]; $TotalMembers = $_POST["inTotalMembers"]; $D...

JQuery/ajax page update help pls

Hi Am new to Jquery/ajax and need help with the final (I think) piece of code. I have a draggable item (JQuery ui.draggable) that when placed in a drop zone updates a mysql table - that works, with this: function addlist(param) { $.ajax({ type: "POST", url: "ajax/addtocart.php", data: 'img='+encodeURIComponent(param)...

jQuery open facebox if the user is currently active on the page?

as we can use facebox as popup. i want to open this POPUP if user is not active for last 30 min on page. and if user press close button or close the popup time will be restarted. ...

input text field resets even if cancelling submit

Hi! i have a form which onsubmit i return false to cancel the submit action (that works fine). but the problem is that even that the submit action was canceled the value on the text input gets erased from the input somehow... search_form.onsubmit = submit_listener; submit_listener = function(e){ console.log(e); return false; ...