javascript

Post to entire document like a form using jquery?

Hi to all, i wan't to pass a variable without using get to php, so, i'm using post with jquery, but i can't write the result into the document (refresh all the page) here is the code: $.post("/"+$(this).attr("href"),{returnto:$(this).attr("rel")},function(a){$(document).html(a);});return false;}); ...

textbox focus out

I need to focus out from the textbox when it focus in. I try to set focus for outer div and its working fine in IE but not in mozilla. How to do this. ...

Help needed in using escape function in javascript

Hi All: I am using the follwing javascript function in my jsp file <script language="javascript"> function openPopup() { var firstname = escape(<%=addressBean.getFirstName()%>); var lastname = escape(<%=addressBean.getLastName()%>); ...

Prototypal inheritance in PHP (like in JavaScript)

Is it possible to employ some kind of prototypal inheritance in PHP like it is implemented in JavaScript? This question came to my mind just out of curiosity, not that I have to implement such thing and go against classical inheritance. It just feels like a interesting area to explore. Are there prebuild functions to combine classical ...

How can I use a Mapnik-Backgroundlayer with lat-lon layers in one map with OpenLayers?

I have an application with a map-client using OpenLayers. I want to use Mapnik-data as background-layer, as provided with the class OpenLayers.Layer.OSM.Mapnik. For that I have to switch to the projection EPSG:900913. But I also want to display some layers, that I can only request in EPSG:4326. Can I combine both layers with the differen...

Accessing an array of HTML input text boxes using jQuery or plain Javascript

I'm looking to create a form which contains a dynamic number of input text boxes. I would like each text box to form part of an array (this would in theory make it easier for me to loop through them, especially as I won't know the number of text fields that will eventually exist). The HTML code would like something like: <p>Field 1: <in...

jQuery, Shadowbox and AJAX

I would like to load some content using AJAX and Shadowbox Basically I would like the user to goto a page in case javascript is off. So this is what I want to do :- 1) Cancel the click event i.e the User must not go to a different page. 2) Load content using ajax function in jQuery 3) Show the content inside a shadow box My code wor...

Does anyone know where I can find a javascript tag cloud generator?

Ideally, I'm looking for something that I can give JSON data retrieved using jquery, and it would generate a cloud based on the data in that query (name, link, size, color, etc...). ...

Is there a way to detect Flash blockers?

I'm wondering wether there's a Javascript way to detect wether a user has any sort of flash blocking plugin installed so i can accommodate these users properly. For example, I use 'click to flash', but sites that use SiFR to render text are littered with "click to flash" buttons, which is getting very annoying. I don't use SiFR in my de...

Keep an SVG Object static while scrolling...

In my web application, I am generating a SVG file which contains a "header" that I would like to keep visible at the top of the window as the user scrolls down the image. I can think of two ways of accomplishing this, but am looking for any other bright ideas. My two thoughts are: Generate two separate SVGs, one being the "header" an...

How to load photoshop action with JavaScript?

Hello! How do I load photoshop's action using its javascript scripting language? Mostly curious in this action steps: Add Noise Distribution: gaussian Percent: 2% With Monochromatic Texturizer Texture Type: Canvas Scaling: 100 Relief: 3 Without Invert T...

Javascript pass variable by reference

How can I pass variables by reference to setInetrav's call back function? I don't want to define global variable just for the counter, is it possible? var intervalID; function Test(){ var value = 50; intervalID = setInterval(function(){Inc(value);}, 1000); } function Inc(val...

Closures in a for loop

Closures in a loop are causing me problems. I think I have to make another function that returns a function to solve the problem, but I can't get it to work with my jQuery code. Here is the basic problem in a simplified form: function foo(val) { alert(val); } for (var i = 0; i < 3; i++) { $('#button'+i).click(function(){ foo(i...

Allowed html/css/javascript - class syntax

I am in the need of defining html classes from content, so pretty much every char could be used. According to html reference I may use cdata, so I should not run into problems. I figure though, that css and/or javascript/jquery won't play nicely with that. Anyone has experience with what chars can be used without problems or if there is...

JavaScript onunload only called if document fully loaded?

Hi, I haven't seen any mention of this is David Flanagan's "JavaScript - the Definitive Guide" book (I've asked this question on O'Reilly Answers too), or anywhere else for that matter, but I am finding that window.onunload is not invoked unless the document fully loaded, which is quite annoying! That's true for IE8 and Chrome 3 at leas...

Stock Price update widget

Hi All, I am working on a small application where I can get the stock price of a particular company also if the price can be updated immediately. I guess there might be a widget that I can use but not sure which one or how. Thanks ...

Add to HTML form without losing current form input information in Javascript

I have a drop down which builds a form based of the selections that are selected. So, if someone selects 'foobar', it displays a text field, if they choose 'cheese', it displays radio buttons. The user can then enter data into these forms as they go along. The only problem is that when they add a new form element, all the rest of the inf...

Html to image in javascript or python

Hi there. Just a dumb question... Is there any way you can create an image, say png, with the content of an html page, with a simple click of a button? Thanks to anyone who cares to answers. ...

How can I launch the eMail client, and then do a page redirect with Javascript?

I'm required to make a website function exactly the same on other browsers as it does in IE6. Part of the current code looks similar to this: <script> function myFunc(){ location.href="mailto:[email protected]&body=Hello!"; location.href="newPage.html"; } </script> <body onload="myFunc();"> </body> in IE, this causes the mail client to ...

jquery submit event and return false

hi i check the blank field in the form and alert the user. but when alert the user it posts the data i couldnt return false not to refresh the page $('#loginAccount').submit(function() { $(this).find(':input:text') .each(function(i) { if($(this).val()=="") { //alert($('label').eq(i).html()) $('#alert3').html...