javascript

xform data grid

I am using orbeon to process my xforms. I am attempting to create a data grid that I can use to copy and paste rows/columns of data from my clipboard (excel). Do you have any clue how I can implement this? I just stumbled on the ajax dhtmlxgrid. http://dhtmlx.com/docs/products/dhtmlxGrid/samples/12_initialization_loading/03_grid_int_f...

ActionScript to Javascript cross-compiler

I learned ActionScript and FlashBuilder about six months ago and then even more recently heard about Google's GWT and Closure. But before diving into java, I wanted to find out if there are any projects underway analogous to GWT but which use ActionScript as the development language rather than java. Is there an ActionScript-to-javascri...

After Effect - Triangle Wave (JavaScript)

Hi, I'm trying to control a parameter with AE expressions and I need a triangle wave. I've got this so far: freq = 20; amplitude = 8; m = amplitude; i = time*freq; m - (i % (2*m) - m); Unfortunately this gives a saw wave (see below) and my math's a bit rusty, any takers? Thanks! PJ http://i25.photobucket.com/albums/c73/pjburnhi...

jquery split() and indexOf results in "Object doesn't support this property or method"

I have the following code: var selected = $('#hiddenField').val().split(","); ... if (selected.indexOf(id) > 0) { ... set value ... } I'm dynamically creating a CheckBoxList, and trying to remember the state of the checkboxes by putting the selected IDs into the hidden field. I get an error stating that "Object doesn't support thi...

how to re-enable default after doing event.preventDefault()

Hi, I know this exact question was asked here, but the answer didn't work for what I needed to do so I figured I'd give some example code and explain a bit... $(document).keypress( function (event) { // Pressing Up or Right: Advance to next video if (event.keyCode == 40 || event.keyCode == 39) { event.pr...

Using JavaScript regex to strip substring that contains parentheses

I have a string called myString that contains some part the end that I do not want: var myString = 'The sentence is good up to here foo (bar1 bar2)'; var toBeRemoved = 'foo (bar1 bar2)'; How can I use best JavaScript regex to remove the part I don't want. The method replace() seems to have a problem with the parentheses. Edit: I d...

Convert flyout menu to respond onclick vs mouseover

The code below creates a nifty flyout menu action on a nested list item sequence. The challenge is that I need to change the default behavior in which the flyouts are triggered by mouseover, so that you have to click to trigger a flyout. Ideally, I would just like to modify this code so that you click on a small icon (plus/minus) that s...

How to open new browser window for popup?

Following Javscript can open popup: window.open('http://www.google.com','mywindow','width=400,height=200'); If call it two times like: window.open('http://www.google.com','mywindow1','width=400,height=200'); window.open('http://www.google.com','mywindow2','width=400,height=200'); The later will override previous only one popup. I w...

How can I write reusable Javascript?

I've started to wrap my functions inside of Objects, e.g.: var Search = { carSearch: function(color) { }, peopleSearch: function(name) { }, ... } This helps a lot with readability, but I continue to have issues with reusabilty. To be more specific, the difficulty is in two areas: Receiving parameters. A lot of times I wi...

JavaScript DEBUG Issue

I am trying to debug this piece of code: $(document).track( { 'module' : 'Omniture', 'event' : 'instant', 'args' : { 'linkTrackVars' : 'products,events,eVar31,eVar32,eVar33,eVar34,eVar35,eVar36,eVar37', 'linkTrackEvents' : '', 'linkType' : 'o', 'linkName' : 'Click' 'svalues' : { 'products' : ';OFFERID1[,;OFFER...

Little help with some (simple) Javascript code

I'm a newb when it comes to javascript. Perhaps somebody could help me with this. I assume it is not very complicated. This is what I would like: <SCRIPT type=text/javascript> var StandardURL = "http://site/Lists/test/AllItems.aspx"; </script> <SCRIPT type=text/javascript> var FilterURL = "http://site/Lists/test//AllItems.aspx?...

javascript: is there any reason scrollTo() would fail to scroll properly while INSIDE the iframe itself?

From within an iframe, is there any reason window.scrollTo(0,0) wouldn't work? In other words, the client code for the iframe itself wants to scroll to the top of the iframe's client area whenever it is loaded. I thought the logic was window.scrollTo(0,0) but it's not working. Any ideas? (To be perfectly clear: if the situation is ...

With javascript, is it possible to define a variable's name with another string value?

Example, I have an array called 'categories' with the value ['4','9']. I'm trying to use that value with the name of a previously defined array. I have several arrays defined earlier called row1, row2, row3 etc. I'm also using jQuery. Trying to do something like this: for (i=0; i<categories.length; i++) { row+categories[i].push($(t...

CKEditor plugin: Hightlight selected text by hovering on a new item in the toolbar and selecting from a drop down

I'm new to the CKEditor and I'm trying to create a simple plugin. What I'm hoping to accomplish is to allow the user to highlight some text and then hover on a new item in the toolbar that drops down on mouse over a few different highlight color options for the text. For example, the user could highlight some text, hover on my new item a...

In Javascript, what's better than try/catch for exiting an outer scope?

In Javascript, I sometimes want to return a value from a scope that isn't the current function. It might be a block of code within the function, or it might be an enclosing function as in the following example, which uses a local function to recursively search for something. As soon as it finds a solution, the search is done and the oute...

How to continuously scroll content within a DIV using jQuery?

Aim The aim is to a have a container DIV with a fixed height and width and have the HTML content within that DIV automatically scroll vertically continuously. Question Basically I've created the code below using jQuery to scroll (move) the child DIV vertically upwards until its outside the bounding parent box where the animation then c...

Dragging a div along with all of its child divs

I have the following code: <body> <div id="container" style="position:absolute; left:0px; top:0px; z-index:1;"> <div id="div1" style="background-color:Red; position:absolute; left:0px; top:0px; width:256px; height:256px; z-index:0;" >&nbsp;</div> <div id="div2" style="background-color:Black; position:absolute; left:2...

How do you make hovering over a link produce a sound.

I have a client who requested piano keys as links and he wants them to sound when the mouse hovers over the keys. How can this be done without using flash? ...

Dynamically adding values to a form with JQuery/Javascript

I am creating a private message system to allow users to communicate between one another within the context of the website (ie, not emails). I have created this function to handle all my form submissions. I would like to achieve a solution without modifying this function (ideally). $("form.reload").submit(function(){ alert($(this)...

javascript adjust div (show/hide) display according to window scroll bar

how to change the div position, i.e in opsolute position, up or down according to window scroll position ? if there any information regarding this, please help me out. or if there any example over this please share. thanks in advance ...