javascript

How do I remove the last comma from my string and replace it with a period in Javascript?

CSS: .dynamicDiv { width:200px; border:solid 1px #c0c0c0; background-color:#e1e1e1; font-size:11px; font-family:verdana; color:#000; padding:5px; } Javascript: //create array var myNames=new Array(); //var nameString=document.getElementById(myNames.toString()) function addToDiv() ...

Switch statement always evaluates the default condition

I need to evaluate the response of a Ajax.Request (using prototype) with a switch statement: new Ajax.Request('http://localhost/somescript.php',{method:'post',parameters:params,onSuccess: function(response) { var result = response.responseText; switch (result) { case "ok": //do som...

How to handle the event when the selected item changes in an HTML select

Hi, I currently have two Ruby selects: one for categories and the other one for subcategories. As you may anticipate, the second one has to update itself every time the first one changes. For example, if I select from the first one the category "Sports", the second select should load all the sports. How can I handle that "index change...

Detect when ALL HTML page rendering has taken place

I am working with a pretty complicated .aspx page that is full of controls (Telerik, Ajax, etc.) that all expand, collapse, show, hide, etc. when the page is loaded. Since this rendering happens on the client-side and can take different lengths of time based on the users machine specs, is there a way to detect when all (or some) renderi...

Get attr form <a href>

Hi, ive got a problem with getting attr from <a href>. Got something likte this <a href="#callback" realurl="callback.aspx">Callback</a> And jQuery $('#callback').bind('pageAnimationEnd', function (e, info) { var realurl = $(this).attr('realurl'); if (!$(this).data('loaded')) { $...

HTML5 concurrent queries

Hi, I am developing a HTML5 based application. I need to process two queries concurrently, one inside another. Pseudo code attached below: function main() { db.transaction( function (transaction) { transaction.executeSql(getDeptQuery, [bind1,bind2],processDepartments, errorHandler); } ); } function pro...

Override document.location.href is it possible in javascript?

Is it possible to override somehow document.location.href ? need override getter, ex.: alert(document.location.href); should return lets say "www.example.com" while real document location is www.stackoverflow.com... don't know is it possible.. ...

Could not get cookie from another (parent) domain in Django

Hi All! I need to remove a cookie that was previously set for parent domain while browsing host at subdomain of the parent. I.e., a cookie "xyz" was set for example.com, and I am trying to remove it on subdomain.example.com, using Django backend. The request.COOKIES given to the view does not contain any cookies except those from subd...

How accomplish variable++ in jQuery?

What is the equivalent of this script in jQuery (if a was an HTML element)? a.value++; and ++a.value; I assume it uses val(), but it seems inefficient to use: a.val(a.val()+1); ...

Possible to style a select slider with JS or JQuery?

I can't find way to style a scrollbar of drop down menu, all solutions are only for DIVs but not for elements. I have tried all JavaScript and jQuery plugins but unsuccessful. You can see the issue in question here (http://liquor.com/asp-test) - click the drop down under Type of Alcohol and you'll see the scrollbar I wish to style. ...

JavaScript "this" references the wrong object within an event handler

I'm writing some MVC JavaScript code using Prototype. The problem is that when I reference this in the snippet below it does of course reference the Window object, whereas I need it to refer to my Controller instance so it can invoke my updateValue function, passing the HTML element ID. I think I have to use bind or bindAsEventListener ...

Javeline XSLT example

While browsing the site I saw the following question. Reading more on the sarissa site I read about Javeline. Would any one have an example of how to perform a transform using Javeline? Also I can not seem to find the following two files: javeline_xpath.js javeline_xslt.js ...

AJAX Drop Down Extender problems updating Textbox with selected index value

Hello, I have a gridview where all rows are editable by default. Most columns require a simple textbox with some formating validators which are not an issue. I do however have 1 column that requires a List of Choices from which the user can select. To do this I am using the Ajax Drop Down Extender to bind to the textbox, so when the t...

javascript associative array initialization error?

<script> var tids = { 308: 1, 312: 1, 313: 1, 314: 1 }; </script> results in "missing } in XML expression with an arrow pointing to the first colon in the JS error console. Isn't this a valid declaration? ...

Javascript: Flash callback method produces error UNLESS alert() first?

Ok I have a flex app and I am adding a callback method like this: private function init():void { ExternalInterface.addCallback( "playVideo", playVideo ); } private function playVideo(videoSource:String):Boolean { videoDisplay.source = videoSource; return true; } I am calling it with javascript like this: function show...

Lazy loading and dependency resolution

some time ago, I was reading an article(a library built by some guy) about how his library can do lazy loading of JS resolve dependencies between JS (typically encountered when trying to "include" one js from another) include files only once. thought specified multiple times regardless of how they are called (either directly specifyin...

Best web based SVG WYSIWYG

I have a site that is in need of a drawing program. My users need to be able to draw floor plans and add text to these images. I'm wondering if anyone has come across a nice SVG WYSIWYG editor. Otherwise I'm going to have to use a Flash or Java app which I'm not fond of. ...

Toggle CSS values using Javascript

I'm trying to modify the behavior of some web parts in Sharepoint (thus forcing IE down my throat) for our users who use the Project server pages. I'm not really the best JavaScript guy, and this is driving me nuts. On one webpart to display the work from Project, there is a subrow 'Planned' shown below the actual data entry row that c...

How to create an N:N relation editor in web page?

I have to create a small "who does what" web application for incoming letter routing: there is a relatively long list (about 600 items) of employees; there is a short list (about 5 items) of tasks; when assigning a task to an employee, due date must be specified; As a result, i need a list (sequence of items matters in this case, sin...

playing audio on a web page without interruption by page reload

Hi, I want to create a web page that contains an (Flex/Flash) audio player that doesnt get reloaded when the page reloads. Currently, i am popping out the player in a new window. Please check http://www.paadal.com to see it in action. What i want to achieve is to have the player in the same window, but it shouldnt reload. I am sure ...