javascript

Returning value from confirmation dialog using JQuery UI dialog

I am using JQuery UI dialog to display a confirmation dialog when a button is clicked. I want to return 'true', when OK is clicked and false otherwise. Associating dialog open call in onClick (as given here, $dialog.dialog('open');) event does not serve the purpose. So, as a work around, I followed approach something similar to this: ht...

Javascript to detect start and end of AsyncPostback of specific Update Panel

<script type="text/javascript"> var prm = Sys.WebForms.PageRequestManager.getInstance(); prm.add_endRequest(endRequest); prm.add_initializeRequest(initializeRequest); var _postBackElement; function initializeRequest(sender, e) { if (prm.get_isInAsyncPostBack()) { ...

How can I tell if a page has jumped to the anchor (#) in javascript?

I have some javascript that can appear on many different pages. Sometimes those pages have been accessed via a URL containing an anchor reference (#comment-100, for instance). In those cases I want the javascript to delay executing until after the window has jumped. Right now I'm just using a delay but that's pretty hackish and obviou...

Javascript syntax: what comma means?

If I use: 1.09 * 1; // returns "1.09" But if I use: 1,09 * 1; // returns "9" I know that 1,09 isn't a number. So, what comma does in the last piece of code? EDIT 1 Another example: if(0,9) alert("ok"); // alert But if(9,0) alert("ok"); // don't alert EDIT 2 Yet Another example: alert(1);alert(2);alert(3); // 3 alerts ...

How to parse an object to JSON using jQuery?

I know to use eval() to parse JSON to an object, but how do I parse an object to JSON format using JavaScript? Thanks. ...

How to create an effect higher up in the view than the logic that determines it?

I have a simple if statement in my view that returns x = 0 or 1. Based on this simple result, I want to change the styling of the div that contains the entire section. <div> conditional that returns x=1 vs x=0 (and a few displayed items) based on this loop, restyle the div </div> Let's say, if x = 1, I want to make background-colo...

Can I "extend" a closure-defined "class" in Javascript?

I have a Javascript "class" defined like so: var Welcomer = function(name) { var pName = name; var pMessage = function() { return "Hi, " + pName + "!"; }; return { sayHi: function() { alert(pMessage()); } }; }; new Welcomer('Sue').sayHi(); Is there a way to "subclass" Welcomer in such a way that I can red...

error on line 39 at column 26: Namespace prefix xlink for href on script is not defined

i am embedding a javascript file inside an svg file like this: <svg xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:cc="http://creativecommons.org/ns#" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:svg="http://www.w3.org/2000/svg" xmlns="http://www.w3.org/2000/svg" xmlns:sodipodi="http://sodipodi.sou...

error on line 1 at column 1: Document is empty

after many questions i am still puzzled as to what my question should be i am getting this error when i add CSS into my SVG: style.css * {margin:0; padding:0} body {font:11px/1.5 Verdana, Arial, Helvetica, sans-serif; background:#FFF} #text {margin:50px auto; width:500px} .hotspot {color:#900; padding-bottom:1px; border-bottom:1px dott...

What versions of mobile WebKit support JavaScript Workers?

My Google-fu is failing me. I'm trying to determine what version(s) of mobile WebKit (iOS, Android, Blackberry Torch, etc.) support the HTML5 feature JavaScript Workers. Anyone know for sure? EDIT I've created a page that logs whether your browser supports the Worker API. Please hit it if you have a mobile WebKit device and I'll post a ...

javascript code not executing!

i have an index.html lik ethis: <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"&gt; <html xmlns="http://www.w3.org/1999/xhtml"&gt; <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <title>JavaScript Tooltip Demo</title> <link rel="stylesh...

Is there a RegExp.escape function in Javascript?

I just want to create a regular expression out of any possible string. var usersString = "Hello?!*`~World()[]"; var expression = new RegExp(RegExp.escape(usersString)) var matches = "Hello".match(expression); Is there a built in method for that? If not, what do people use? Ruby has RegExp.escape. I don't feel like I'd need to write...

javascript objects questions

Hi all, I am from c# object oriented background and which to work similar priniciples in javascript. Any good I articles that could help with me research? This is an example i put together for a Product Javascript object: function Product() { this.reset = function () { this.id = 0; this.name = ''; } } Product....

jquery: how do i know if i have it?

i need jquery to work on a browser locally. how do i know if it is installed and how do i install it ? my question is specific to being able to run this code: onmouseover="evt.target.setAttribute('opacity', '0.5'); $('#someDiv').show();" onmouseout="evt.target.setAttribute('opacity', '1'); $('#someDiv').hide();" ...

document.body.style.backgroundImage vs document.body.background

What is the difference between the two? ...

what does #someDiv mean?

when the user puts his mouseover this object i want a message to pop up: onmouseover="evt.target.setAttribute('opacity', '0.5'); $('#someDiv').show();" onmouseout="evt.target.setAttribute('opacity','1)'); $('#someDiv').hide();" what exaclty does someDIv mean? where do put the text? i am doing this and it is not showing the text at al...

jquery: how to use an id selector?

Possible Duplicate: what does #someDiv mean? i am doing this: onmouseover="evt.target.setAttribute('opacity', '0.5'); $('#someDiv').show();" onmouseout="evt.target.setAttribute('opacity','1)'); $('#someDiv').hide();" but i guess i need something called an ID selector? anyway how do i make it so that when there is a mouseov...

Disable a class using Javascript?

I am using a e-commerce package and there are sections my client wants disable to hidden. The problem is the package has all their labels under the same class and I am not sure how I can target certain ones in order to hide or disable them. I have 5 and would like to hide the 3rd one, lets say. They are in a table to so it looks ju...

Javascript/C#: Appearing Textarea OnClick

I have an html list. Within this list are a series of images, some information and a button. When the user clicks the button, I want a textarea and a button to appear below the associated image within the list. The user then fills out the textarea with some machine learning feedback and clicks the button to send a postback to the serv...

JavaScript or jQuery image carousel/filmstrim

I am looking for some native JavaScript, or jQuery plugin, that meets the following specification. Sequentially moves over a set of images (ul/li) Continuous movement, not paging Appears infinite, seamlessly restarts at beginning Ability to pause on hover Requires no or minimal additional plugins I realize this sounds simple enough. ...