javascript

Is it possible to encapsulate event logic to avoid duplicate code?

Say when a checkbox is checked/unchecked, I want specific behavior to occur. Now if there are multiple points in my code where I set a checkbox as checked/unchecked, I have to run through the same logic ever time. What is a way I can encapsulate the logic that occurs when a checkbox is checked, and just re-use that logic? ...

dojox.grid.DataGrid select a row by a column's value

I am not familiar with dojo. I have this application I am using that has a dojo data grid. <table jsid="grid" id="grid" dojoType="dojox.grid.DataGrid" store="store" clientSort="true" style="height: 400px;" rowsPerPage="10" postrender="setTableCount(store,'count');" > <thead> <tr> <th field="enabled" width="24px" st...

Horizontal Accordion - jQuery plugin - scrolling animation bug on Firefox - how to debug

There is a plug-in for jQuery that allows you to build horizontal accordions, it works great in all browsers except firefox. My main problem is that I'm somewhat unfamiliar with debugging client side code, I'm a Java programmer mostly, although I do have a good understanding of client technologies, actually trying to debug this issue le...

Anyone knows how create a javascript "effect" for slide the website

Hi My boss (my pointed hairy boss) want an effect in javascript for show an advertise. The effect he wants is some like this. When the user enter the site, a banner must appear and "push" the website out the screen, and that space must be use for the banner. After a few seconds, the banner must to disappear, and the website restore. I l...

Need help with logic on how to assign the correct value to a textbox

I am passing in a value to the form that I ultimately assign to a textbox using javascript. The value is a calculation based on values from another page/form. However, the textbox is editable. When reloading the form with the previously saved data, I don't want the value of the textbox to be overwritten with the pre-calculated value ...

How to override HTML image using CSS

Hi, I have my current code: #content img[src="/img/test.gif"] { background-image:url(dark-img.png) !important;} From my understanding !important; overrides existing values? Why isnt this overriding the current HTML image in place there? The background shows up, behind the HTML image. I want it infront of the HTML image, is this pos...

How to make a <div> adjust horizontally by the user

I have a vertical side navigation bar and i would like its width to be horizontally adjustable. May someone please direct me to a tutorial or plugin that would help achieve this? Thanks ...

Drag scrolling on web

how to make scrolling like this: http://na.blackberry.com/eng/devices/blackberrypearl.jsp ...

How to get the index of the element in javascript?

The NodeList don't have a indexOf(element) method? So, how can I get the element index? ...

Complex wolframalpha ajax query

I want to write formulas in Mathematica format in my blog, inside tag's formula. What js should I use (and what libary), to replace those tag's, with http://www.wolframalpha.com/ search result image, when Dom gets loaded? For example: <formula>Limit[((3 + h)^(-1) + -1/3)/h, h -> 0]</formula> gets replaced with: If it's to complex o...

x is not defined, setTimeout problem

With the following code I get a clock is not defined error, why? $(function(){ function clock() { var nd = new Date(); var h, m, s; h = nd.getHours(); m = nd.getMinutes(); s = nd.getSeconds(); if (h <= 9) h = "0" + h; if (m <= 9) m = "0" + m; if (s <= 9) s = "0" + s;...

How to style a scroller using Javascript

I have a site where on the sidebar I have some videos with a scrollbar (http://mibsoftware.us/clients/raveis), I need to figure out how style this scrollbar so it can be a different color, etc. What is best way to do this? Any help would be greatly appreciated. the scroller is inside a div ...

Scriptaculous accordion from stickman not working

hi, I'm trying to get stickman's Scriptaculous Accordion control to work within my page, with no luck for quite a while now. I can see the headings for each accordion element but the content is invisible. The problem seems to be that the font-size style property stays at 0 for all accordion_content elements. My HTML page is below: <!DO...

How to tell if an image has loaded correctly

Is there a way to tell, after the fact, whether an image (placed with the <img> tag, not via JS) has loaded correctly into a page? I have a gallery of head shots, and occasionally the third-party image server ends up serving up a 404. I can change the server-side code to use an onerror="showGenericHeadshot()", but I really want to avoid ...

Jquery - operators in if statement

Hi All, I'm trying to submit a form to a different location depending on which (of two) form fields have been filed in. It work when both fields have a value but when only one if field has a value it always submits to the suppliers/category/ URL. Here is my code. $('#suppliersForm').submit(function() { catVal = $('#category').val() k...

list of restricted words

I believe we can share our compilation blacklisted keywords for use in forum or comment system to filter out unwanted spam and words like s*x, f**k. I hope you can share all your list here. ...

How to remove an automatic click event on google map overlay?

Hi, Can anyone help me to remove click event from the kml polygon? When I click on any part of polygon, window message pops up with a data KML TEST which is from KML file. I just want to have polygon drawn over google map without having any click events. Does anyone know how to achieve this? This is my page: http://www.keithwoodrow.c...

IDE Like interface with jQuery (Resizing divs)

Hello, I am planning to develop a site which will have interface very similar to IDE I was wondering if there is a jQuery plugin which allows the resizing of divs (horizontal / vertical based on settings) or any ideas on what would be the best approach. ...

What are the benefits of compiling your Javascript code?

I'm diving into web development and, as I inspect the source of some web pages, I see people referencing "/scripts/compiled.js", which tells me people are compiling their javascript code. What are the benefits of compiling javasript code? What are the popular tools used for compiling javascript code? Thanks so much in advance for you...

How to change jqeury dialog html content after init?

Hello all, I have a working dialog, and i want to change the content durring the flow of the app, I mean to change the .html() propery of the dialog... I thought it was easy to do but i can't seem to do: $dialog.dialog().html(SOME CONTENT); How do i do that after i allready have the diqlog running? My init code is: var $dialog = $(...