javascript

Javascript Strings don't compare, escape characters not being escaped when using jQuery.val() func

I have: <input type="text" value="Raphaël\nkicks\nbutt!" id="tzbox_txt"> var inputText = $("#tzbox_txt").val(); var stringText = "Raphaël\nkicks\nbutt!" inputText === stringText - false! If I use $(input).val() I get "Raphaël\nkicks\nbutt!" where \n is not being interpreted as line breaks. And if I do var text = "Raphaël\nkicks\nbut...

Find the width of a left floated list and apply to wrapper div to center it using css - jQuery?

Hi, I wish to center a ul in a div that is the left column of a liquid layout. To do so I need to set the width of a div that I've used to wrap the ul. Note: the list items (and content) are retrieved from a database using php. I'm interested in your suggestions on how to do this using jquery. Consider the below markup: <div id="wrap...

Urls for results of Ajax requests

Hi guys I've developed a google maps application witha neat search feature - however I've noticed that I would like to have something like what the facebook guys have done as in having a hardlink to a page that is generated by an ajax query. Example you click on a link in facebook and it appends to the current url and you can copy paste...

Simple JavaScript String.replace.call results in "InternalError: too much recursion"

Given the following JavaScript "class" definition: var Quota = function(totalMinutes){ this.totalMinutes = parseInt(totalMinutes || 0, 10); }; Quota.prototype.valueOf = function(){ return this.totalMinutes; }; Quota.prototype.toString = function(format){ format = format || "hh:mm"; return format.replace.call(this, /hh...

Stop certain elements from being edited inside a doc having designMode = "on";

I am using an iframe and setting its contendocument.designMode to "on". This allows me to replicate a Rich Text Editor, and achieve much more flexibility in the editing process. The problem is that I have certain links (<a href="#" onclick="alert(1);">test</a>) that are added to the page, and of course these links don't work because i'm...

javascript add prototype method to all functions?

Is there a way to add a method to all javascript functions without using the prototype library? something along the lines of : Function.prototype.methodName = function(){ return dowhateverto(this) }; this is what i tried so far but it didnt work. Perhaps it is a bad idea also if so could you please tell me why? if so can I ...

Local HTML 5 database usable in Mac Dashboard wigdets?

Hi I'm trying to use HTML 5's local database feature on a Mac Dashboard widget. I'm programming in Dashcode the following javascript: if (window.openDatabase) { database = openDatabase("MyDB", "1.0", "Sample DB", 1000); if (database) { ...database code here... } } Unfortunately the database-variable remains alway...

Javascript timelapse-effect: displaying 30 images/second (read for more detail)

Hello! I have a client who has made a 'Visual Diary' of photographs that he took once a day for 365 days, for his portfolio site. He wants me to put these together into a time-lapse effect piece. I thought about using Flash but in the end opted for JavaScript. What needs to happen is this: The images cycle really really quickly with no...

description text in a text field?

i want to put some description text in light grey in a text field. then when a user clicks on it the text disappears and he can type whatever he wants. is there a jquery plugin for this? i dont know what to search for in google. ...

Paint all pixels (excluding transparant) in PNG with Javascript/CSS?

Hello, I need to create a silhouette of a PNG with Javascript/CSS. Is this possible? I tried the following: Stack the PNG with lowered opacity multiple times with absolute positioning and z-index. This does not work. Unfortunately I can't use PHP or something else then Javascript and CSS. I got some ideas with overlays and such but I...

Bookmarklet for ScreenScaping

http://dy-verse.blogspot.com/2009/08/screen-scraping-with-javascript-firebug.html[link text][1] outlines a strategy to parse a page and submit contents to a Google spreadsheet that depends on Greasemonkey. I'd like to adapt this approach to a simple bookmarklet where, instead of hardcoding in the page address to be parsed, i would manua...

Any Python alternatives to Selenium for programmatically logging into websites that require JavaScript for login?

I’m writing a little private app to automatically log into my internet banking every day, and download the latest transactions. I’m writing it as a Django app, so I’m working in Python. My internet banking doesn’t seem to work without JavaScript — I think it uses JavaScript to assign a session ID of some sort. Fetching the sign-in page ...

move cursor to the beginning of the input field?

when you click on 'Ask question' here in Stackoverflow you see a text "What's your programming question? Be descriptive." i want the same thing and all i need for that is to move my cursor to the beginning of the text field. how do i do that with jquery? ...

WebMethod return values in JSON format

How to return values from Webmethod to the client in JSON format? There are two static int values that i want to return. Do I need to create new object with those 2 properties and return it? The GetStatus() method is called frequently and i don't like the idea of creating a special object each time just for json formatting... [WebMet...

duplicate html element

Hello, anyone knows of any jquery plugin that handles duplication of some random html elements? I'm looking for a way to dynamically add identical rows to a form. I know its not hard to make, but i don't really want to reinvent the wheel here. ...

no value from $_POST

No value is sent to $_POST['addEdit'] variable :(, pls help HTML code: <form name='frm' method='POST' action=''> <table cellpadding="0" cellspacing="0" border="0" width="100%"> <tr class="heading"> <td style="width:5px;"><input type="checkbox" name='check_all' onClick='checkAll();' /></td> <td class="head">App Name</td> . . <?php //som...

jQuery External RSS Feed Parser?

I've been looking around for a decent jQuery feed/XML parser and found good plugins like jFeed and jParse (among a few others). None of these support retrieving an external feed though, which is something I'm after. Pretty sure this is down to jQuery's $.ajax() method rather than the plugins themselves (as they'll be built from this). ...

doctype error with googlemaps

Hello, I am having an error when I try to display googlemaps If I load the googlemaps javascript source I get this error in firebug syntax error [Break on this error] <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML...3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">\nmaps?fil...sor=false (regel 1) I have this to load the file <?php if (isset($gmap...

JavaScript: What is the equivalent of PHP's "$this->$somefunc()" ?

Is it possible to store the name of a function as string in JS, and invoke it from an object, pretty much like the PHP code below? $this->$someFunc(); ...

Is there a useful purpose for <style type="text/javascript">?

What is the use and purpose this , is it useful? ...