javascript

Jquery - Does the ajax/load() method automatically show the content it's loaded?

I'm really stuck here... I've built a small gallery to display images. It consists of an initial front page with 12 thumbnails arranged in a grid. When click on a thumbnail they collapse to the left of the screen and show the appropriate gallery item. When you rollback over the collapse thumbnails they expand and hide the gallery item u...

Javascript: Adjust date in textbox using keypress event

I have a standard <input> textbox where users enter a date. I'd like to add some functionality where users can enter + or - to add/subtract a day from the value. I added an onkeypress event that calls this function: function adjustDate( element ) { var e = event || window.event; var code = e.charCode || e.keyCode; switch( ...

JQuery and XSLT

Good day, I have stumbled upon a bug or some strange behaviour and I can't find the solution anywhere. I use XSLT to display HTML from a XML document. Inside that stylehsheet, I use javascript/jQuery to add some contents. But apparently you can not append anything but texts to any container. <script type="text/javascript"> <![CDATA[ ...

[dijit menu] catch menu positon, and edit menu after creation

I'm working with the dijit.Menu widget, but I don't know how to do some things: How can I catch te position of the top left corner of a dijit context menu? How can I know witch dome node belongs to the dijit menu, (to do that I write into the menu the DOM node id and I find it with dojo.byId, but I don't think its the best way) How can...

Two JavaScript "processes"

I'm using a product called DHTMLXGrid, which is a JS library for creating spreadsheet-like tables on a web page. When I edit a cell, and then click outside the cell, an event is fired (they call it onCellEdit) and I do stuff to handle that event - an AJAX call to save the cell data to the DB. But if the user edits a cell and clicks a b...

js script works only when alert is present - not an ajax call

An OnClick event calls the following datepicker function. If an alert is present then, it works fine. Otherwise, it does not show the calender as required. Is this a timing issue? function changeStartDate(Item){ alert ("alert goes here"); $("#datepicker_" + Item).datepicker({ dateFormat: 'M-dd-yy...

How do I run an object's method onEvent in javascript?

Hello, I just started using javascript and I'm missing something important in my knowledge. I was hoping you could help me fill in the gap. So the script I'm trying to run is suppose to count the characters in a text field, and update a paragraph to tell the user how many characters they have typed. I have an object called charCounter...

Can I get usable data in a jQuery live handler for a custom event?

jQuery now allows you to use live to handle custom events, something I've used in my latest project and found very handy. I have come up against a limitation/bug, however, that I'm hoping someone will be able to help me with. When you trigger an event, you can pass additional array of data too, like this: $(this).trigger('custom', ['f...

Getting icon from local file with JavaScript

I have a web form that will upload a user-selected file. I need to get the icon file that is registered on the user's system for this file to upload it along with the uploaded file. How can I access a local file and extract its associated icon in the browser with JavaScript? If this can be done, and you know how, thanks in advance. ...

How do I retrieve several hex values that are included in a a URL query string using jQuery?

I have an image tag that looks like this: <img src="http://www.example.com/render/pattern?obj=patterns/pattern_1&amp;color=7F8C6C&amp;obj=patterns/pattern_2&amp;color=C8D9B0&amp;obj=patterns/pattern_3&amp;color=FFFFD1" width="100" height="100" alt="" /> Is it possible for me to use jQuery/Javascript to search the src attribute to find...

Strange problem with jQuery ajax post.

Hi, I have very strange problem and that problem occurs very rarely and that too in our production env. The production env. setup is, Apache Web Server as front layer Apache Tomcat 6.0 as application server (liked with Apache Web server via mod_jk) I have custom made Ajax based RPC component where we use jQuery for ajax calling. The ...

XML parse sub-parents of root node

Here's books.xml, an xml that I'm trying to traverse: <?xml version="1.0" encoding="ISO-8859-1"?> <!-- Edited by XMLSpy® --> <bookstore> <book category="cooking"> <title lang="en">Everyday Italian</title> <author>Giada De Laurentiis</author> <year>2005</year> <price>30.00</price> </book> <book category="children"> <title lang="en">...

Script.aculo.us Events in Rapid Succession results in display error...?

Using the script.aculo.us Effect.Highlight on an onMouseOver event works perfectly - if the user only mouses over the DIV once. If they mouse back over the DIV during the execution of the effect, another Effect gets scheduled (or runs in parallel, depending on whether or not {queue: 'end'} is enabled). Does script.aculo.us have a ...

Extending javascript with keywords

My Google-ing on this has been unsuccessful, so here's the question: I am wondering if it is possible to add my own keywords to extend the JavaScript language in a given framework. For example Object1 extends Object2 in the code would result in executing this method inherit(Object1, Object2) Where inherit is a function that take...

Validating Google Optimizer javascript code via HTMLParser

I'm trying to include the Google Website Optimizer JavaScript code, below, in a Zope3 page template. It's used for for A/B testing. However, the template html parser, which I believe is the standard Python HTMLParser module, throws the following error: raise PTRuntimeError(str(self._v_errors)) - Warning: Compilation failed - Warning: <...

How to round a decimal to the nearest fraction?

Not sure if that is the right way to ask this or not but here is the problem. Given a latitude of 26.746346081599476, how do I find the number 26.75 as the 16th greater than the number and 26.6875 as the 16th lower than the number? 26.0 26.0625 26.125 26.1875 26.25 26.3125 26.375 26.4375 26.5 26.5625 26.625 26.6875 My Number: 26.746346...

Need to find actual location of line/char in Internet Explorer Script errors?

I'm receiving a script error in IE: Line: 59 Char: 71 Error: Expected identifier, string, or number Code: 0 Line 59, character 71 don't seem to actually correspond to my code. It doesn't even say what file, but I've looked at my main javascript file, viewing the page source, etc. This has happened to me before and I've looked aroun...

How to keep Jquery function from overwriting one input field with onclick write to second input?

I have a form with two input fields and a tag cloud. I want the user to put focus in the first input, then click a tag thus triggering a jquery function that puts the clicked-on tag in the first input. Then the user focuses the second input, clicks a tag triggering a similiar jquery function to put the second tag in the second input ...

Inject Javascript to a website

I have a problem in which a website presents me with a list of several thousand pages of 50 items available per page. Unfortunately they did not offer a way to "jump" pages. For example, if I am on page 1 and I want to go to page 2500 out of 5000 my only option is to click the highest page number displayed on the screen (in increments...

Question about JavaScript graphic animation: saving and restoring a "sprite" background

I am writing a train based game in Facebook Javascript. I have an inverted triangle that represents the train and dashed lines that represent track which connects cities in Europe. The train moves along the track to travel from one city to the next. At this time, I redraw the gameboard with every page refresh. This has the effect of alwa...