javascript

Javascript replace() - Exclude the $1 from the replace rule

Hi, how can i exclude the $1 from the replace rule? regex = new RegExp('hallo, test, blub', 'gi'); content = content.replace(regex,'<strong>$1</strong>'); alert('$1'); // dont work Thanks in advance! Peter ...

Javascript - declare array of objects containing objects ...

I have an array of objects that contain other objects. At the moment the way I declare them is pretty long winded. Is there are more condense way to do the following: function city(name,population) { this.name = name; this.population = population; } function state(name) { this.name= name; this.cities = new Array(); } function coun...

Disable Location Bar of Browsers in Pop-up Windows

I have the following HTML with Javascrpt : <A HREF="javascript:void(0)"onclick="window.open('http://www.msn.com/','New Windows','height=380, width=300,location=no')">Hide Address Bar</a> It's working fine with IE but not FireFox 3 and later. I want to disable the "Location" bar when pop-up windows shows up. ...

Failed to override the getResponseHeader method on XMLHttpRequest

I was trying to override the getResponseBody method on XMLHttpRequest object. The code looks so: xhr.onreadyStateChange = function(){ if (xhr.readyState !== 4) { return; } if (xhr.status === 200) { // callback to handle the result } else { var _orig = xhr.getResponseHeader; xhr.getResponse...

I've hashed together this simple script to rotate pictures and link them to specified URL's, how do I make it pause when I mouseover the picture?

<a id="imageurl" name="imageurl"><img src="Rotating1" id="Rotating1" border="0" alt="Rotating1" name="Rotating1" /></a> <script language="javascript" type="text/javascript"> function RotateImages(Start) { var a = new Array("1.jpg","2.jpg","3.jpg", "4.jpg"); var c = new Array("url1", "url2", "url3", "url4"); va...

Handle HTML code block as an object ?

Hi ! I have a div that basically represents a book (so a nice div layout with an image of the book, title, price, red background if on sale etc.). So what i do is to get the properties of a book from the database, insert the values in kind of an html template and display it. Now, once it is displayed i hate how i have to handle the da...

Placing and centering div inside a div

Hi All, I wanted to achieve the following layout. basically 1 div placed inside the other. Div1 has circle as background image.(size of div varies) I want to position Div2 so as i always get the above layout I tried using centering a div inside another ..didnt work. Do I have to specify top and left for Div2?? I want to be able to d...

Tweet Me Button - JavaScript Button

I an trying to add the Tweet Me button (http://twitter.com/goodies/tweetbutton) from Twitter to my site. However whenever the button is pressed I get this JavaScript error: A("a.ab-reloading").livequery is not a function Anyone know how I could fix this/ ...

Twitter $get help

Just wondering if someone can assist me with the following issue. I have come across the following code which pulls in latest Twitter posts and displays them on a site: //Handle the scrolling of the tweets in the footer $(function () { var tweetVP = $("#footerTweetsViewport"); arrTweetNav = ECC.tweetArray(); thisTweetID = a...

Draw a Connection Line in RaphaelJS

How would I go about drawing a connection line in Raphael where the mousedown initiates the starting point of the line, the mousemove moves the end point without moving the start point and the mouseup leaves it as it is? ...

Preload a Google Maps overlay

I'm trying to use a Google Map as a background, with a fixed overlay. Have a look-see. You can see the problem — whilst it's loading, the text is unreadable. The overlay is loaded by Google's JS. How can I hide the map until the overlay has loaded? (Or a better solution?) ...

Get URL parameters in JS and embed into a JS function

I have a graph library that I use to plot some data. This data comes passed as a GET paramater in the URL in the following format: plottedgraph.html?case_id=4&otherparam=blabla Then I have my HTML page where I try to catch that GET param with the GUP function (below) and add it to my JS function as follows: "http://www.url.com/showgrap...

restricting javascript widgets to certain domains

I need to create a webservice providing javascript widgets and ajax calls, which only run on certain domains. After doing a lot of research, I only came up with a combination of HTTP-Referer and API Keys, which is pretty easy to break with tools like RefControl, or am I missing something? Are there more secure solutions for this problem?...

How to detect language in JavaScript?

I know that in Wordpress we can do the following: preg_match("/\p{Arabic}/u", get_the_title()) How can we do this in JavaScript? Thanks in advance. ...

How to get the return value from a jquery GET request?

I would like to do something like this: function blabla(); var check = blabla(); if(check == 1) But in my blabla function I have a Get request and I have a callback but can't get the return value to be the blablas return value; var checkemail = 0; $.get("bla.aspx", { day: "friday" }, function(data)...

How to open local disk file with javascript

I tried to open file with window.open("file:///D:/Hello.txt"); The browser does not allow opening of local file this way, probably for security reasons. I want to use the file's data in the client side. How can I read local file in javascript? ...

javascript Error: 'return' statement outside of function when trying to disable a button on submit

Am trying to re-use a function i got from one of the threads on this site. I want to disable an asp.net button when clicked such that a user does not click it several times. The button is inside an Ajax Updatepanel and also has a ConfirmButtonExtender, but when i click it, it get this javascript error in internet explorer. ** Erro...

How do I stop dynamic JavaScript tables from moving other elements around when I add rows to the table?

I have an HTML page that has static tables placed in the page because these never change. I have a main table that houses all the elements to keep everything aligned. This is probably what is causing the problem. I have the main table with 2 tables within it. Each row in the first inner table, called dropDownTable, usually has up to abou...

which javascript IDE automatically parse include js file in HTML code?

I'm using Aptana plugin for eclipse, but it doesn't parse included js file when I write js code in a HTML file.Is Aptana support this function? If not Could you please show me which javascript IDE automatically parse include js file in HTML code? Thanks for help. ...

Javascript Array

i want to use javascript array globly using netbeans ide.. i declare the array like this.layer=new Array(); and var layer=new Array(); but the problem is that when i use the array in function the drop down menu of Array functions is not shown as netbeans shows. ...