javascript

Scriptaculous problem in IE

Hi there. We've got this very annoying problem with Scriptaculous and Internet Explorer 7/8. We have two Effect.toggles on the same page, but only one of them is ever working (the first one). I hope it's some simple mistake in my implementation, but I can't seem to find any decent documentation. Hopefully somebody here can help. The HTM...

Prototype/Scriptaculous/JavaScript Data Picker control

Hi All, In a current project we need a calendar control that can display 2 months at a time rather than the standard 1 month. Unfortunately the project is heavily tied to the Prototype API and Scriptaculous, so the option of using jQuery or any other framework is unavailable. So the control needs to be written in Prototype, Scriptaculou...

Ruby on Rails: Javascript: How to grob focus when the text box appears

So, I have <script type="text/javascript"> function grabFocus(){ document.getElementByID("category_name").focus(); } </script> <div> <h1>New category</h1> <br/> <% remote_form_for :category, @category, :url=>{:action=>'ajax_create'} do |f| %> <%= f.error_messages %> <%= f.hidden_field :object_type %> <p> <%= f.text_field...

How do I convert a string into a bitmask in javascript?

Now, this is simple enough when the numbers are small, but numbers like "9223372036854775807" are too large for parseInt(). I'm not sure how to do this within the Google docs script editor, which doesn't seem to allow for external classes. ...

Convert python variables into javascript variables

I want to use Google Chart API using javascript. (I don't want to use the python wrapper) So how do I send data from my python code into the javascript to create graphs? ...

ckeditor: how to wire up menu buttons?

I have ckeditor embedded into one of my pages....but I don't know how to wire up certain buttons in ckeditor to perform specific actions. Most importantly, how do I tell it when the save button is clicked to save the document? ...

Change DIV order with jquery

Hello, I'm working on a client's HTML based site and need to randomly order a set of Divs on refresh of a page. I would normally handle this through PHP and a database call, but it's a static site. So, I'm wondering if anyone knows how to randomly display a set of div's using jquery? Here's an example: <div class="myItems"> <div...

Is using a select list for navigation SEO Friendly?

I really don't like the use of select/option elements for links, but they've found their way into the designers portfolio as an option and try as I might to dissuade them from using them, I know I'm going to lose the battle without the power Google and "it's bad for SEO". I searched all over the net, and can find nothing specific to sup...

How to inject a javascript function from one page into another

Alright, let me preface this by saying that I have little programming experience, so I apologize if my explanation belies some serious ignorance. I've always wanted to learn certain tricks but I can never find any tutorials. Here's the deal: There's a website that gives you various science questions and grades the input. For each que...

javascript: how to determine initial mouse position?

hi. how can i determine the initial mouse position? right now i use onmousemove, but that sometimes only fires when the mouse is actually moved. same with onmouseover. if i dont move the mouse, i observed the following: it seems like in IE a mousemove event is always fired right at the beginning, in firefox never, and in chrome strang...

Get the full path of a node, after get it with an XPath query in JavaScript

Hi, i have the next instruction, in JavaScript: var firstScene = document.evaluate('//Scene', document, null, XPathResult.FIRST_ORDERED_NODE_TYPE, null); so my question is how to get the full path of the node firstscene? ...

javascript - dom searching for id returns an error - how to handle?

for (i=1; i<=4; i++) { try { timer = document.getElementById("timer"+i).parentNode.parentNode.parentNode.childNodes[1].childNodes[0].childNodes[0].className; } catch(e) { FM_log("aguardaReforcos()", "ERRO - timer"+i); } ... I have to it this way with try because otherwise I get...

render partial using ujs and without AJAX call on rails 3

I need to do multiple file uploads using nested form and jQuery. so I wrote an helper using link_to_function method: def add_document_link(title, form) link_to_function title do |page| form.fields_for :documents, Document.new, :child_index => Time.now.to_i do |f| page << "$('#documents').append('#{escape_javascript(r...

Parsing CSV data in JavaScript

i have a string coming in like this 138374:order1,738437:order2,927438:order3 etc I am doing a loop to split orders by comma (,) but now how to I furthur split it to the order number and oredert name thats is separated by semicolo(:) Below is the code function(getOrders) { var completeOrderRequest = getOrders.split(',...

Javascript: how to handle a next item in json - playlist

I have an application that creates a playlist of videos and returns them in json format, the video ID is the "key" and then it has video information attached to it. The video ID is not sequential, "1234", "4234", "123", "5454" are possible IDs, among others. I have a button for switching the next video, the problem is I don't know how t...

Handling events on dynamically generated JavaScript objects

I have an object I created in JavaScript. Let's say it looks like this: function MyObject() { this.secretIdea = "My Secret Idea!"; }; MyObject.prototype.load = function() { this.MyButton = $(document.createElement("a")); this.MyButton.addClass("CoolButtonClass"); this.MyButton.click = MyButton.onButtonClick; someRan...

Getting value from table cell in javascript...not jquery

I can't believe how long this has taken me but I can't seem to figure out how to extract a cell value from an HTML table as I iterate through the table with javascript. I am using the following to iterate: var refTab=document.getElementById("ddReferences") var ttl; // Loop through all rows and columns of the table and popup aler...

setting opener property on iframe

Hey all, The framework i'm using (django admin) pops up a new window when adding new items to the database. I would like to use a light box instead of popping up a new window (fancybox for now), and i'm using the iframe option. However, when i click save in the iframe, a request gets sent to the server, and the server responds with a pa...

Is there a bignum library for JavaScript?

Is there a bignum library for JavaScript that I can include like <script type="text/javascript" src="the_bignum_library.js"></script> ? I think my users would prefer to enter numbers in a web page and wait a 7 seconds for a result, rather than download an executable and click through a bunch of "this executable could possibly harm yo...

passing element in XMLHttpRequest to one function but second one also knows, why ?

I am working on the jsp/servlet/ajax application. I use XMLHttpRequest to pass values from the jsp page to servlet, which retrieve data from the database and returns xml to the jsp. The code works but there is one thing I do not understand. Here is an JSP part <body> <label>Longitude</label><input type="text" id ="lat" value=...