javascript

jQuery - Minified gallery, change background-color via CSS?

Hi, I have a site where I randomize the background image using a php rotator script file. But I was thinking, is it possible to create a small preview gallery of each background image and make it so that when the user hovers over an image, the css background image of the site is changed on the fly? And when the user clicks on the image h...

How can I pass checkbox onclick event to parent onclick ?

I a with an onclick event and , and inside it. When I click on the checkbox then the div-onclick event doesnt fire - I would like it to fire without having to dublicate the onclick onto the checkbox. <div id="id-tag" onclick="do()"> <span>text</span> <img src="pic.jpg" /> <input type="checkbox" name="mycheck" /> </div> I know...

Efficient USD formatting in Javascript

Say I have a string: 33400298.57 I've written a function (too long, too bloated, too substandard to post here) which formats this into: 33,400,298.57 The meat logic is the insertion of commas - leftwards of the decimal, every three places. Can there be a one line solution using regex to accomplish this? Presently, I'm splitting, reve...

Help understanding a regular expression

I am an amateur in JavaScript. I saw this other question, and it made me wonder. Can you tell me what does the below regular expression exactly mean? split(/\|(?=\w=>)/) Does it split the string with "|"? ...

Json problem with Page Method call on IE 8.

I have the following code that populates a select element with values from an ajax call, via a Page Method. In FF, the code works perfectly, in IE8 I get the error: 'ResourceList[...].id' is null or not an object. What can I look at here? function readShift(jsonString) { var shiftInfo = Sys.Serialization.JavaScriptSerializ...

Change background color for rows of an HTML table on click

Hi, I need that when i check a checkbox i apply different background color to HTML table rows according to and ID of a user in database using jquery, and then i uncheck the checkbox go to previous state. For the record i am not asking for code i am asking for concept. http://www.freeimagehosting.net/image.php?ef44cf44a5.jpg ...

XUL: fit all elements vertically in prefpane

here goes the XUL part of one of the preference panes. <prefpane id="alt-about" label="About" image="chrome://alt/skin/about.png"> <hbox> <vbox> <image id="alt-about-logo" /> </vbox> <vbox> <description id="addonName">Bla bla bla, bla bla</description> <description id="version...

Avoid multiple autocomplete calls by wrapping it with SetTimeOut

Here's my issue : using an autocomplete jQuery plugin, I'd like to avoid multiple ajax requests when user strikes his keynoard by surrounding the $('#query1').autocomplete({ serviceUrl:'/actions/autocomplete?population=salon', minChars:3, maxHeight:300, wi...

Conversion of DOM element selection code to jQuery

I have a large Javascript codebase to convert to jQuery. The code is structured such that DOM elements are created in Javascript (using a library called DomBuilder), and saved to variables if they will be needed later, before being added to the DOM. Eg. var inputs = { submitConfirm: INPUT({type: 'button', value: 'Submit'}), su...

How to decode the url in php where url is encoded with encodeURIComponent()

Hey Guys, How to decode the url in php where url is encoded with encodeURIComponent()? I have tried the urldecode() but then also..i don't the url which i have encoded... I have to do this in php.. ...

Using javax.script, how can I get underlying Java Exceptions to survive through JavaScript?

We used to run rhino, but now with Java 6 we want to switch and use the built in JavaScript support. We are injecting Java objects into JavaScript and run methods on them. When something goes wrong -- Exceptions are thrown we want to handle those exceptions. We used to be able to get them by just getCause on the exception but that is no ...

Click to show more - maybe JS?

I am not sure what language or how to do this, but I am looking to have a word on a page, and when clicked, it will reveal more underneath. If it is clicked again, that stuff will hide away again? Any ideas? ...

avoid dialog box when netscape.security.PrivilegeManager.enablePrivilege("UniversalXPConnect"); is called.

Hi i got to create.write,read a local file within the javascript using XPCom. For that i have included the below line at the beginning of javascript. netscape.security.PrivilegeManager.enablePrivilege("UniversalXPConnect"); But when the above script executes, a dialog box appears saying **Internet security** A script from "fil...

Javascript : Submitting a form outside the actual form doesn't work

Hello all, I'm trying to achieve a fairly easy triggering mechanism for deleting multiple items from a tablegrid. If a user has enough access he/she is able to delete multiple users from a table. In the table I have set up checkboxes, one per row/user. The name of the checkboxes is UsersToDeletep[], and the value per row is the unique U...

How to remove period (.) from OL numbering?

http://jsbin.com/urice I want to remove . after number. 1. should be 1 only With All browser compatibility inducing IE6 and validity. I need solution without javascript. Edit : If it's not possible with css only then a simple javascript and jQuery solution would be appreciated, thanks. ...

Checking equality of 2 DOM Elements.

How may I check if 2 Dom element are same. Form example var element1 = document.getElementById("abc"); var element2 = document.getElementById("abc"); Now how should I chekc that these 2 elements are equal? Thanks ...

Why are my JavaScript variables not persisting across functions?

I have the following JavaScript in my HTML page referencing an HTML form on the page: <script type="text/javascript"> <!-- var myForm = document.myForm; function validateForm() { if (myForm.myInput == "") alert("Please input some text."); return false; } myForm.submit(); } function showFormInput() { ...

How do I change the value of an input element?

is it possible to "override/overwrite" an input element fixed value using javascript and/or jquery? i.e. if i have an input element like this: <div id="myDiv"> <input type="text" name="inputs" value="someValue" /> </div> is it possible to make a jquery object of that element and then change its value to something else then rewrit...

Changing Dropdown based on Other Dropdown Menu

I've seen a few questions like this, but mine is a bit more specific so I hope this isn't considered a repost. I am working on a website that is built with struts 2 and hibernate. I need to dynamically populate a drop down menu using data from a sql query based on an option selected in another drop down menu. So basically when the firs...

SmartGWT with Rest Data Source Error

I am getting the following error when retrieving data from a rest data source 00:00:52.439 [ERROR] 01:46:57.001:RDQ1:WARN:ResultSet:isc_ResultSet_1 (created by: isc_CustomerDocGrid_0):get: invalid index -1 com.smartgwt.client.core.JsObject$SGWT_WARN: 01:46:57.001:RDQ1:WARN:ResultSet:isc_ResultSet_1 (created by: isc_CustomerDocGrid_0):ge...