javascript

Center an Image vertically and horizontally? css

How do i vertically and horizontally center an image when i do not know the size of it? I asked this question and someone suggested using a table. This isnt the first time i heard a table can do it but i tried without luck. Searching SO only got me results when i do know the size of the image. How do i do this with a table? NOTE: Javas...

How to calculate a 20 character string from a fixed session id and a non-fixed length page name

It's Friday afternoon and my brain is fried. I have a unique server side ID stored in a cookie. For site stat purposes i need to have a unique event identifier of no more than 20 characters which is made up of the page name and the remaining number of charcaters from the session id. So if the page name = selectPlan that is 10 characte...

Show an image in a fixed position in Google Maps; visibility depends on the zoom level

I have a dynamic map in Google Maps (API v2) I want to overlay an image inviting the user to zoom The image disappears when the zoom level is greater than (say) 10 Any idea how to achieve this? Thanks ...

how to dynamically (re)position an element according to the bottom of the page using JS / Jquery?

Hi All, the back story: i have a tab section on a page which when navigated through displays sections (divs) of varying height. the result, is that certain inputs (which are strangely positioned for reasons i can't change) on this page reposition themselves problematically. the proposed solution: as the page height changes, have the...

Click ID and open URL?

Hi Guys, I am trying to click on a #ID and open a URL - but [as a newbie] - I can't seem to get it. I am using $('#Test').click(function() { OpenUrl('some url'); return false; }); ...

Why are pushpins automatically added to my VEShapeType.Polyline object

Hi, I am trying to create a number of polylines in Javascript. For some reason, bing maps automatically/randomly adds pushpins in the middle of some of these polylines. Does anyone know why this is the default behaviour and how I can override it? Thanks! ...

Prevent tab into field

How can I prevent a user from tabbing into a field (comboxbox)? ...

OAuth-Wrap Beginners Tutorial

Ok im looking for beginners OAuth-Wrap tutorials. I want to know where to begin. I will be using Javascript / PHP for my coding. I want to play around with an API that uses OAuth-Wrap. If can help me that would be much appreciated :) ...

Matching Regular Expression in Javascript and PHP problem...

I can't figure out how to get the same result from my Javscript as I do from my PHP. In particular, Javascript always leaves out the backslashes. Please ignore the random forward and backslashes; I put them there so that I can cover my basis on a windows system or any other system. Output: Input String: "/root\wp-cont ent\@*%'i@$@%$...

Separating Javascript functions

I am wondering how javascripts get included in a jsp - can we put any code which the jsp will recognize and not just javascript code only in the .js file? I have some common javascript code which needs to get executed on different pages, so I decided to place it in its own separate .js file and include it on all jsps which call that fun...

What's the quickest way to write a simple browser client to talk to a REST server

I'd like to create a simple browser client that I'll to demo the REST API we have implemented on a server. I need basic functionality like Create an item on server using POST: client fills up a few parameters and posts Get list and display using GET: client sends a query, gets an XML list of items and displays them I don't need any f...

Javascript and backslashes replace

here is my string: var str = "This is my \string"; This is my code: var replaced = str.replace("/\\/", "\\\\"); I can't get my output to be: "This is my \\string" I have tried every combination I can think of for the regular expression and the replacement value. Any help is appreciated! ...

Global javascript variable not accessible in jquery change event

I have to be missing something simple, but I'm really not sure what. I'm not a JS veteran, so this may be an easy answer - sure hope so :). I have a button that, when clicked, gets JSON data. When a drop-down is changed, I check to see if there is data, if there is, I want to clear it out as the drop-down indicates what data to retrie...

Problem with ExtJS vbox layout nested in a hbox layout

I'm trying to get a layout to look like this : I've had all sorts of fun trying to get this working. I finally got something that almost works, but only because I dropped in the 3.2 beta of Ext JS. I'm left with one final problem. The code below will display the panels almost correctly, however, the right hand panel doesn't stretch t...

constructors and inheritance in JS

Hi all, This is about "inheritance" in JavaScript. Supose I create a constructor Bird(), and another called Parrot() which I make to "inherit" the props of Bird by asigning an instance of it to Parrot's prototype, like the following code shows: function Bird() { this.fly = function(){}; } function Parrot() { this.talk = funct...

Google Chrome, IE problem with adjusting style before AJAX

When I'm using AJAX, I typically do something before each request to let the user know that they'll be waiting for a second. This is usually done by just adding an animated loading gif. When I do this, Firefox does what you'd expect and adds the gif before moving control to the next line (where the AJAX is called). In Chrome, it locks th...

Including a minified js code in another js library

I want to incorporate a minified javascript library (for example http://sizzlejs.com/) into my own non minified javascript library. The reason is that my library plugs into other websites and I don't want to ask them to include the extra library (sizzle) as well. Is there a way to include a minified library in a non minified library and...

Speed up :visible:input selector avoiding filter

I have a jQuery selector that is running way too slow on my unfortunately large page: $("#section").find(":visible:input").filter(":first").focus(); Is there a quicker way to select the first visible input without having to find ALL the visible inputs and then filtering THAT selection for the first? I want something like :visible:inpu...

JavaScript for child items in menu in telerik MVC controls

i know i can use .ClientEvents for the parent items in menu to call javascript funtions. is there a way i can call javascript functions from my child menu items? Thanks ...

Select menu closes once you click on it

I create a <select> menu using Javascript then attach it to the page. But when I click on it, it closes immediately. Here's my code, I'm stumpped. var accounts = [ ['user1', 'password'], ['user2', 'passowrd'] ] function html(){ var button = '<a href="#" id="switchacc">Switch User</a>&nbsp;• &nbsp;'; $('a[href=search.ph...