javascript

Parse js arrays in ruby

Hi All, i've js file that holds Array objects and data assigns var A_1_val = new Array(7); var B_1_txt = new Array(7); A_1_val[0] = '111'; B_1_txt[0] = 'utf8_content'; A_1_val[1] = '222'; B_1_txt[1] = 'bar'; etc.. need to get these arrays in ruby. found http://github.com/jbarnette/johnson, but it can't correctly return a...

Javascript parses in some way the string parameters of functions?

When I try to pass a string to a function like so i="file:///bla/bla/bla"; Fade(i); i get Uncaught SyntaxError: Unexpected token : so i tried passing a literal in the function like f("img1.jpg"); and i got Uncaught ReferenceError: img1 is not defined (anonymous function) What is going on? (note that i am kind of new in js) In pa...

Using mapped image to fill a text box in a form

Hi guys, I'm new to php and javascript. I'm working on a form that have 3 sets of checkbox and a text box. When a user clicks on the checkbox a popup window of mapped image comes out. The image is a map. When the user clicks on a certain city, the text box get's filled with whatever city the user clicks and then closes. So far, this is ...

how to manage large client side only web apps

I am building a project which uses jQuery UI for the client side. My goal is to have my web-app never do a postback and do everything client side. While developing though I found almost all my code goes into 1 .js file and 1 .html file where I have a lot of div's which I show and hide when appropriate. Is there a better way to organize...

Javascript Call from ASP.NET GridView - Parameter not getting passed

I use a jQuery popup window to show a new page with a parameter in the query string. <script language="javascript" type="text/javascript"> function ShowProfile(clickedItem) { $.fn.colorbox({ html: '<iframe SCROLLING="Yes" frameborder="0" src="SiteVP.aspx?siteid="' + clickedItem + ' width="999" height="550" />', wi...

prototype update method to COPY vs MOVE

i am using prototypes update method. what i notice is that when it updates the receiving element with the providing elements innerHtml, the providing elements innerHtml is removed. not only the innerHtml, but the entire element. is it possible to retain both the element AND the innerHtml? so basically i just want to COPY the innerHtm...

jQuery how to make event occur every x seconds?

Hey. I have a code like: $("#clickMe").click( function(){ if (i == 1) { i = i+1 $("#div p").css("left", "-" + width * i + "px"); } }); As you can see -margin changes when somebody clicks a button. What if I want it to happen j...

Why is this simple javascript not working?

New to js here. Basically I am trying to detect the existence of a string in the present page's url with this: var url = window.location; var param = /\?provider=/i; if (url.search(param) != -1) { alert('it does exist'); } else alert('it does not exist'); It works when I manually define the url variable like so var url = 'htt...

Javascript sticky dependant dropdown

I asked a question regarding this problem about a few hours back and have noticed that this still isn't working correctly. What I need is to show a textbox to the user if they select a two of the three choices. When the user clicks the submit button the dropdown needs to maintain the value chosen. I can do this with my application code ...

webgl and the power of two problem

I want to use webgl to make a little 3d gallery of flickr photo streams. It looks like webgl only allows square images thats dimensions are a power of two to be used as textures. I need to be able to display images of any proportion and dimension. I can see that if I copy the image data into another image that is the nearest square di...

How to bypass "Visual Studio Just-In-Time Debugger" prompt

Visual Studio Just-In-Time Debugger prompts to select "Possible Debuggers", only "New instance of Microsoft Visual Studio 2010" is available, I tick "Set the currently selected debugger as the default", click "Yes", but, the dialog keeps being displayed every time. I am debugging JavaScript in IE8 on Windows 7 x64. How do I bypass th...

How to correctly write copyright/license info in PHP/JavaScript based projects?

I am developing web applications for various clients. I also have libraries that I use in multiply projects and I also incorporate BSD and other open source libraries. I am using PHP server side. I want to make the licensing clear both for my PHP and both for my JavaScript files, but at the same time I want to keep this simple, I want ...

jQuery UI draggable does not work in Firefox with "error draggable() is not a function"

It is really weird that the draggable works in all browsers but Firefox. I tried in IE6.0, Opera, Safari, all are ok. But Firefox prompted below error: $("#draggable").draggable is not a function. Here is my code: <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dt...

Any recent performance comparison among Javascript, Silverlight and Flash

This is really a duplicate of the question- link text I googled it and found some old results like bubblemark.com, link text and link text. But is there any recent benchmarks as all the platforms have been updated. I like to measure the speed of silverlight 4 against the modern and faster javascript engines. Anyone have any source? ...

Javascript to Java using JSON

I am planning to send Javascript array object filled with data by encoding it in JSON. Any good jquery plugins for this ? On Java end, what is the standard way of parsing the JSON into a Java array ? Overall flow is like this: Javascript compiles bunch of data on current page and stores it in array. Array object encoded into JSON. J...

why projection is undefined using google maps v3 .

this is my code: var i=0 google.maps.event.addListener(map,'bounds_changed', function (){ var bounds_=map.getBounds(); if(!i){ set_node_to_top() i=1; }); function set_node_to_top(){ MyOverlay.prototype = new google.maps.OverlayView(); MyOverlay.prototype.onAdd = functio...

Javascript REGEX: How to get `1` and not `11`

If I do this: var string = "7,11,2" var check = string.match("/1/"); if(check != null){ doSomething(); } else { doSomethingElse(); } Then check is not null because match has found 1 in 11. So how should I avoid this and get 1 when it really appears? ...

Is there a way that I can auto redirect people to a different page based on their state?

I am new to this and have been playing around, I was wondering if I could auto redirect people from the landing page to a page that would have information about their state. Like url.com/ to url.com/michigan.htm The current code that I've found <script language="Javascript" src="http://gd.geobytes.com/gd?after=-1&amp;variables=Geo...

What's the problem with my script?

Why is this giving me null? <script language="javascript"> var element = "11"; var string = "7,11"; var check = string.match("/(^|\D)"+element+"(\D|$)/g"); alert(check); </script> When I run the regex on http://regex.larsolavtorvik.com/ it works correctly. Pleeeease help I want to sleeeep! :)) ...

Real Time data graph

I would like to build a web-based real time data graph and i'm looking at the different options such as: Html5 canvas JS libraries with graph support such as Extjs Can you please recommend any ? ** UPDATE ** By real time i mean, either the client polling the web server say every second or using reverse ajax; the server pushes data...