javascript

Mootools - selecting the font element with color matches the pattern and injecting the el after each. How?

Hi! How would be correct to get the font elements in the table with color="#0000cc" and drop after each the new img Element? I'm trying to do like that, but it doesnt' work $$('.tdresult font').each(function(el){ var state=el.get('color'); if (state.match('#0000cc')) { var newel = new Element ('img' , { 'src' : 'images/case.png' ,...

How can I display code better on my blogger blog?

These days, in any site where they show a code fragments (even in Stackoverflow), the code is nicely wrapped around a GUI element which highlights syntax elements, provides line numbers, etc. I want to show some ruby on rails code in my blog and I want those visual elements in my blog. How can I accomplish this on my blogger blog? ...

Javascript - get a variable from inside the local scope of a function

I am not great with anything beyond basic javascript so please forgive the simple question. I am using the jsDraw2D library. This library has a graphics object that looks something like the following: function jsGraphics(canvasDivElement) { var canvasDiv; this.drawLine = drawLine; function drawLine(point1, point2) { // do th...

Closing a jquery modal dialog from a remote page

Hi all, I'm using the jQuery-UI dialog widget in a Grails-based application to load a remote page (in this case, a simple file upload form). The remote page is defined elsewhere in my project, and doesn't know it is being loaded in a dialog. Is there any way to close the dialog via a link in the remote page? Would I have to somehow p...

open a new window displaying the google search results

Hi, when user selects a text, my extension automatically searches on google the selected text and the search results are displayed on a new popup window. var searchWindow = ww.openWindow(null, "http://www.google.com/search?q=" + encodeURI(annotateSelectText)+"", "searchWindow", "menubar=0,status=0,width=750,height=...

Intercept asp:LInkButton postback for client side confirmation dialog?

I want to inject a confirmation dialog to allow the user to cancel the click before the postback occurs. What's the cleanest way? <asp:LinkButton ID="Btn_RemoveContractPeriod" Text="Remove" runat="server" OnClick="OnRemoveContractPeriod_Click"/> ...

Compare date in javascript

I have a custom validator that points to a Client side script to validate a textbox. My date and time are separated into two textboxes - one with date in mm/dd/yyyy format and the other with time in hh:mm am/pm format. I need to make sure the textboxes together are not greater than now. How can i accomplish this? Here is what i have s...

Overriding Attacklab script included by script src=

I use stackexchange.com, which uses the same editor stackoverflow has (the editor I use now) When I try to type a special character using right alt + key (other language characters), instead of my special character I get ctrl + key shorcut, e.g. Undo (by pressing right alt + z), numbered list (by pressing right alt + o), hyperlink (by pr...

get values from adjacent table rows

i have a function to handle click of clickedcell. I want to exctract value of sibling cell with class "desired". how exactly to specify? <tr> <td class="desired">someValue</td> <td><span "clickedcell"></span></td> <td></td> /tr> ...

jQuery split long ul list in smaller lists

I have a long UL list I need to break up in smaller lists containing about 20 items each. I was thinking I could use something like $(function() { $("ul li:nth-child(20n)").after("</ul><ul>"); }); but that's not the case. Any idea how to use jQuery in a way that uses minimal CPU? Thanks ...

Javascript; Accessing frameset frames from within other frames.

I have a system in place which uses a frameset, within the frameset frames there are some calls like; top.frame1.location = "newlocation"; and top.frame2.afunction(); However I am updating the system, and now the frameset resides inside an iframe, so obviously all of the top.frame.whatever calls no longer work. Now I'm trying to f...

dojo dynamically loading DropDownSelect widget

Hi all, I have two DropDownSelect widgets added to my from what i need is to dynamically load the data in the second DropDownSelect widget as the first DropDownSelect widget changes how can i load the data in DropDownSelect widget programitacally. Abdul khaliq ...

how to put focus on a dynamically generated field in update panel

Hello, i'm dynamically generating asp controls inside an update panel on a certain trigger. However, when the text control is generated, the focus goes on to the next pre-existing element and screws things up. Is there a way I can trigger a javascript event after the update panel has been updated? ...

Popular JavaScript Inheritance Patterns

I'm working on an ebook on GitHub on TDD JavaScript and I'm wondering if I'm missing any popular inheritance patterns. If you know of any additional patterns I'd love to see them. They should have the following: Time tested - used in real apps Source code should be supplied. Should be as straight forward and pedantic as possible. Of co...

ExtJS - SyntaxError: missing ) in parenthetical

I am writing some code to educate myself in the ways of ExtJS. I am also new to JSON so hopefully this question will be easy for you to answer. I am trying to retrieve some data from a basic web service that I have written which should be returning its results as JSON (seeing as I am new to JSON - it could be that that is broken). The e...

image naturalWidth return zero

image naturalWidth return zero... that's it, why ? var newimage = new Image(); newimage.src = 'retouche-hr' + newlinkimage.substring(14,17) + '-a.jpg'; var width = newimage.naturalWidth; alert (width); HELP, i dont know why ! *** that path is good, the image show up ! ...

jquery: using appendTo in second to last row of table

I have a piece of the DOM that I'd like to insert into my page. Currently I'm just blindly using: $(myblob).appendTo(someotherblob); How do I do the same thing, but append myblob to the second to last row that is within someotherblob. someotherblob in this case is a table and I want to inject a row above the second to last one. ...

Problem accessing OnChange javascript event of Radio Button

I'm running in to the same problem this individual has. Specifically, I'm trying to get a clientside onchange javascript event to fire for my Radio Button. Unfortunately, the code gets rendered with the onchange located on a span surrounding the radio button instead of on the radio button itself. I am using other javascript within the...

Instantiate stdClass in place

Is it it possible to do this in php? Javascript code: var a = {name: "john", age: 13}; //a.name = "john"; a.age = 13 Instantiate the stdClass variable on the fly ? ...

jquery and grouping checkboxes

So this is what I have: <script src="scripts/jquery-1.3.2.js" type="text/javascript"></script> <script> $().ready(function() { var allVals = []; $("input[name^=utType]").each(function() { var input = $(this); var name = input.attr('name'); var num = /\d+$/.exec(name)[0]; if ($(this).chec...