javascript

jQuery - sepcify a directory for cycle plugin

forget my question for a while... bad choice of words i am using this code for a jQuery Cycle Slideshow... script is here... you may skip it and proceed to question <script type="text/javascript" src="code_snipets/jquery.js"></script> <script type="text/javascript" src="code_snipets/jquery_plugin_cycle.js"></script> <script language="...

how to get all 'li' element from #1 to #demo1 using jquery .

this is my code: <div id="demo1"> <ul> <li>aaa</li> <li> <ul> <li>hhh</li> <li>qqqq</li> </ul> </li> <li>qqqqq</li> <li> <li>lll</li> <li> <ul> <li>qqwed</li> ...

Prototypes in JavaScript

In the JavaScript the same thing you can do in many different ways. Consider the examples: 1: function Circle(radius) { return { "r" : radius, "area" : function(){ return Circle.pi * this.r * this.r; } } } Circle.pi = 3.14159; var a = Circle(10); alert(a.area()); 2: function Circle(radius) { this.r = radius; } Cir...

Can I store JavaScript Functions in arrays?

How can I store functions in an Array with named properties, so I can call like FunctionArray["DoThis"] or even FunctionArray[integer] Note: I do not wish to use eval. ...

how to get <head> content of the current page with jquery or Jv

how to get <head> content of the current page ...

how to open outside links in a new tab

On my website i have many outside links, as well as internal links. i'd like some kind of solution in javascript or w/e that detects outside links and opens them in a new tab, but leaves internal links to be opened in the same tab. thanks! =) ...

When fine tuning performance, what is the best way to call Javascript methods multiple times?

Hello, I have been researching Javascript performance. I've learned that when accessing more than once, it is usually best to copy closure variables and class members into local scope to speed things up. For example: var i = 100; var doSomething = function () { var localI = i; // do something with localI a bunch of times v...

Performance of setting img src to unchanged value?

If I have an img tag like <img src="example.png" /> and I set it via myImg.src = "example.png"; to the same value again, will this be a no-op, or will browsers unnecessarily redraw the image? (I'm mainly interested in the behaviour of IE6-8, FF3.x, Safari 4-5 and Chrome.) I need to change many (hundreds of) images at once, and man...

Prototype to jQuery: Mindset migration?

This isn't about a side-by-side technical comparison, rather about how to "think in jQuery" versus "thinking in Prototype". I've used Prototype heavily for several years, and jQuery somewhat less heavily until about a year ago when I started doing a lot with it. With Prototype, I can write some fairly elegant code; my boss once reviewe...

ASP Update Panel, catching exceptions

Hi, Thisis the code I use to display an aspxloadingpanel with an ms update panel: var prm = Sys.WebForms.PageRequestManager.getInstance(); prm.add_initializeRequest(initializeRequest); prm.add_pageLoaded(pageLoaded); function initializeRequest(sender, args) { pbar.Show(); } function pageLoaded(sender, args) { var panels = ar...

Submit form in javascript using form name

Hi, I'm dynamically generating forms with hidden input in a webpage using django templates, which should be submitted when clicking on some associated text label. The problem is that I just can't get it to work. {% for tag in tags %} <form name="remove_{{ tag }}" id="{{ tag }}" action="/filter" method="post" accept-charset="utf-8"> ...

Getting certain frequency with setInterval method

In a javascript code I develop, some function should be called every 1 second. But to be sure that this operation takes place every 1 second, the following code is utilized: setInterval(doIt, 500); function doIt() { var now = (new Date()).getTime(); if(lastUpdate + 1000 >= now) { /// code... lastUpdate = now; }...

Hiding a description in a dynamic table

I have a table that is created using PHP and when you click on the name of the item I want the description to show. <table border="1" bordercolor="#000000"> <tr class="trintial"> <th width="50px"><input type="checkbox" readonly="readonly" checked="checked" /></th> <th width="300px">To-Do Item</th> <th width="100px">Prior...

How to get jquery jScrollPane and jscrollHorizontalPane plugins working together?

I have a div where I must have both vertical and horizontal scrollbars stylized. I'm already using jScrollPane by Kelvin Luck. But I would like to integrate it with jscrollHorizontalPane, a mod based on the first. Has anyone able to make them work together? Any other suggestion will be very welcome. thanks. ...

Does using prototypes in JavaScript have any real world advantages?

I just finished Doug Crockford's The Good Parts, and he offers three different ways to go about inheritance: emulation of the classical model, prototype-based inheritance, and functional inheritance. In the latter, he creates a function, a factory of sorts, which spits out objects augmented with desired methods that build upon other obj...

parent url of an opensocial container

Is there a way to get the "parent url" of an Opensocial container? Google Sites embeds gadgets through an Opensocial container and I'd like to grab the parent's URL to generate a message. Is this possible? ...

jquery json to string?

Instead of going from a json string and using $.parseJson, I need to take my object and store it in a variable as string representing json. (A library I'm dealing with expects a malformed json type so I need to mess around with it to get it to work :( ) What's the best way to do this? ...

Turn function on and off

I have a jQuery tip function. I would like to create a button to turn on and turn off the function. I want it to be on by default. Is it possible to create a link to turn on and off a function? ...

Help with simulating depth in HTML5 Canvas

Basically, I'm trying to do 3D projection on a 2D canvas with simulation of depth. As a general rule, bodies that are further away are "shaded" more and smaller than bodies that are closer to the viewer. The only thing missing is having bodies that are further away always drawn behind bodies that are closer. Sometimes, bodies that are ...

how to remove all attributes from <body> with js or jquery

how to remove all attributes from with js or jquery. (I don't know what is the attributes in the body, i want remove all them) ...