javascript

How can I set existing HREF links to open in a new window with javascript

[edit] I am NOT using jquery in this app. Looking for a way to force preexisting links to open in a new window. But I only want to Apply this behavior to links appearing in a specific div element that has a classname but no ID ...

What is the best practice to decouple GUI design from server-side development when developing modern web applications?

We are currently developing a few web applications and are letting our designers convert signed off paper prototypes into static web pages. In addition to having hyperlinks between pages the designers have started adding jquery calls to update elements on the pages by fetching data from static json files. Once the designers are finished ...

Javascript file as an anonymous function

I have been reading a lot of Javascript lately and I have been noticing that the whole file is wrapped like the following in the .js files to be imported. (function() { ... code ... })() What is the reason for doing this rather than a simple set of constructor functions? ...

How do I make a JQuery Slider-like feature on iPhone/Android web app?

In the iPhone or Android, if you have a JQuery Slider, it doesn't quite work (touchscreen will move the screen instead of drag the slider.) ...

what is () in this snippet of javascript?

I'm trying to read the Prototype source. I've come to this part.(Unfortunately, this snippet is in the beginnning). What does this () mean? Browser: (function(){ var ua = navigator.userAgent; var isOpera = Object.prototype.toString.call(window.opera) == '[object Opera]'; return { IE: !!window.attachEvent...

jquery load problem

I'm having a problem where a jquery load function wipes out the dom element that it is targeted at. popup_content.load('form.html #print_options1', function() {popup_content.fadeIn();}); when popup_content is a div targeted by jquery. A jquery load was previously used to load content into this div without problems. This time, though, t...

How to design single page application in javascript to work in environment mode?

I'm developing single page application in javascript and consume data from RESTful web service. I host it on simple lighttpd web server. I want to have different url for consuming data by environment like development mode points to my local web service and production mode point to online webservice. ...

How to get a javascript overlay to load on startup

I want to have a javascript overlay box load on startup inviting users to participate in a feedback survey. How can I do this. I do not want a separate window. ...

Richtextbox library

I would like to use a JavaScript richtextbox library in my application. What library does Stack Overflow use, and is it available for me to use? ...

ExtJs - Set a fixed width in a center layout in a Panel

Hi all, Using ExtJs. I'm trying to design a main which is divided into three sub panels (a tree list, a grid and a panel). The way it works is that you have a tree list (west) with elements, you click on an element which populates the grid (center), then you click on an element in the grid and that generates the panel (west). My main ...

How can i raise activate event in Asp.net?Is there any possibility?

We have activate event in windows application like that is there any event in asp.net? How can i raise activate like event in Asp.net?Is there any possibility? ...

How to refresh a page from another page in asp.net?

How to refresh a page from another page in asp.net?I have one page called Common.aspx.Once i click some button another page(Company.aspx)should refresh.How It possible? If Not ClientScript.IsStartupScriptRegistered("ReloadPage") Then ScriptManager.RegisterStartupScript(?,Me.GetType(), "ReloadPage", "ReloadPage();", True) End...

Regular Expression for Finding URL (ending with FLV/flv)

I need to get all instances of http://someurl/somefile.flv within a HTML file. Extension must not be case sensitive. I currently use the following simple regular expression that I use in Javascript: var rePattern = new RegExp( "(http://.*.flv)", "gi" ); It has it's flaws though, especially if there is a URL and somewhere...

javascript check for not null

Below is a code snippet, where we retrieve a form value. Before further processing check if the value is not null.. //-- code snippet starts here var val = document.FileList.hiddenInfo.value; alert("val is "+val); //-- this prints null which is as expected if(null!= val) { alert("value is "+val.length); //-- this returns 4 } else {...

Dynamically adding target attribute to a collection of pre-existing anchor tags within a known div element

I have a div with id="images". The div contains some images that are each wrapped in an anchor tag with no target attribute. I'd like to insert script into my page that pulls a reference to each of these anchor elements and ads a target="new" attribute to them (in the runtime) so that when they are clicked they each open in a new win...

reading the current url of a tab.

Hi all! I need to read the browsers URL (specefic to the tab) using javascript. I tried the var currentURL = window.location; alert(currentURL.href) ; It shows chrome://browser/content/browser.xul instead of the web address. What should I do to get the web address? Can someone please help me out with this. Thanks! ...

How do I do a Javascript Redirect in asp.net

Hi All, I have a asp.net webform with a button. The OnClientClick event is wired to a javascript function. I need this function to redirect the current page to this page. After much reading is have tried all the following, but to no avail: var url = "http://www.google.com"; document.location = url; //Doesn't Wor...

How to add a text box on a button click?

I am writing a JSP page where an admin can prepare the question format for the users. All the questions have multiple choices ranging from 2 (for yes or no) to 5. I want to provide a button for the admin which on click has to generate a text box corresponding to 1 answer. This button should also check that the answer boxes have not excee...

JavaScript regular expression: can (?=regex) and (?!regex) be used in the middle of a regular expression? Or they must be used at the end of a regular expression?

Hi guys, In JavaScript, can (?=regex) and (?!regex) be used in the middle of a regular expression? Or they must be used at the end of a regular expression? If they can be used in the middle, what's the meaning of it? Great thanks! ...

can i make javascript persist after a refresh?

In my form i need to select an item (which is a div with text or an image) and i do set the id of a hidden input via jquery live click event. In the case the user has logged out or session has expired he must go back and refresh the page (after logging in). After a refresh firefox keeps all input data (textarea, text, select, etc). BUT...