javascript

JQuery Each setInterval Repeat Problem

I'm using a set interval function with jQuery to loop through a list of times on a calendar so that the individual divs can be refreshed. First I put this code on a page that was called via Ajax, but the function would never receive the new date variable set. It would just recognize the variable it saw when the page was first loaded. Th...

Can I declare the same value for two attributes at once

For example, for accessibility reasons I want my onfocus and onmouseover to have identical values. For the sake of maintainability I want to declare this once only. What I'd like to be able to do is this: <a onmouseover,onfocus="assist('hello');">linktext</a> But, of course, that would be too easy, and doesn't work. What's the best...

Hard code values into config.js assistance? CKEditor 3.2.1

Hello gals/guys, I am trying to hard code the bottom values into my configure.js file in ckeditor root. My goal is to hard code all submitted text as black text color and a light blue background. Values are below. How can I integrate these values into configure.js? Thanks! nano ...

Pushing elements into array as copy

In prototypejs, why does the following code remove the matching divs from the #test div? What confuses me is that this happens when they are being inserted in the #droparea, and not when they are being pushed in the array. <div id="test"> <div class="foo" id="22.1234"> 1 </div> <div class="foo" id="22.1235"> ...

Custom configuration file custom_config.js not working?

Hello gals/guys, I am trying to use a custom configuration file instead of the default config.js file in the ckeditor root. I have placed a renamed copy of the config.js file in my webroot and call it with customConfig. It is not working for me though. Is my syntax creating any issues? I used the dev docs site as a ref: http://docs.cks...

Does Javascript has an effect to the printed version of the site?

Simple question, don't have a printer around, My client is asking if the hiddent elements of the web page(items that show up on click) will be printed out on the paper or will it be hidden? ...

Find the clicked li number

I have a standard list... <ul> <li><a href="#">blah 1</a></li> <li><a href="#">blah 2</a></li> <li><a href="#">blah 3</a></li> <li><a href="#">blah 4</a></li> </ul> And my jQuery: $('ul li a').live('click', function() { var parent = $(this).parent('li'); }); What I...

Equivalent of object using literal notation

See following class: function availItem(xs, s, m, l, xl) { this.xs = xs; this.s = s; this.m = m; this.l = l; this.xl = xl; } How can I declare the above class using JSON? I think It should be in following manner but problem is to pass argument. var availItem = { ...

Asynchronous Controller is blocking requests in ASP.NET MVC through jQuery

I have just started using the AsyncController in my project to take care of some long-running reports. Seemed ideal at the time since I could kick off the report and then perform a few other actions while waiting for it to come back and populate elements on the screen. My controller looks a bit like this. I tried to use a thread to perf...

How to optimize this javascript code?

I have a jsp which uses a lot of javascript and it's just not fast enough. I would like to optimize it so first, here's a part of the code: In the jsp I have the initialization: window.onload = function () { formCollection.pageSize.value = "<%= pagingSize%>"; elemCollection = iDom3.Table.all["spis"].XML.DOM; <% ...

Delete Button issue

Hi, I am using one link button in an asp.net application for delete purpose. For the confirmation i added the property of OnClientclick="return ValidateOnDelete();". By Default it works as fine. But i have One condition is that When the user is not admin, the delete button will be disabled. My problem is that, if the user clicks on the d...

Google Maps - Reserve Geocode -> Error "invalid label"

Hello! I have the coordinates of my marker. Now I want to get the address of the marker. So I searched the web and found google maps reserve geocode. Now I tried to do the following: $.getJSON('http://maps.google.com/maps/api/geocode/json?latlng='+point.lat()+','+ point.lng() +'&key='+apiKey+'&sensor=false&output=json&callback=?', funct...

How can I check, if a scrollbar is visible?

Hi, I want to display a "Go to top"-Link on my website. This link should only be visible, if the vertical scrollbar is visible. How can I do this using JavaScript? Thanks ...

How do I match and return a zero with a regular expression in javascript?

I am trying to extract a number from a string. The number might be zero. Numbers appear like this: '+123', '-8' or '0'. alert( '+123'.match(/[-?|+?]\d+/) ); alerts +123 alert( '-8'.match(/[-?|+?]\d+/) ); alerts -8 alert( '0'.match(/[-?|+?]\d+/) ); alerts null // why oh why? How do I get '0'.match(/[-?|+?]\d+/) to return 0 instead of...

What's the solution for this kind of problem?

<a onclick="run(&#039;Hi, Tim! I&amp;#039;ve got two&#039;, &#039;">test</a> The onclick event is not run at all. The above is generated by something like this: <a onclick="run(<?php echo htmlentities($str) ?>)">test</a> How to fix it? ...

Binding mousemove within mousedown function with jQuery

I am trying to bind a mousemove event to a div when the left mousebutton is down, and unbind when it is released. This code should be fairly self-explainatory. function handleMouseDown(e, sbar){ if (e.button == 0){ console.log(sbar); //firebug sbar.bind('mousemove', function(event){ handleMouseMove(event,...

Best solution to wait for all ajax callbacks to be executed

Hi! Imagine we have to sources to be requested by ajax. I want to perform some actions when all callbacks are triggered. How this can be done besides this approach: (function($){ var sources = ['http://source1.com', 'http://source2.com'], guard = 0, someHandler = function() { if (guard != sources.length) { return; } //d...

Organization of the jQuery Object

I was going through the source code of jQuery. I'm having trouble understanding the wrapping strategy for the jQuery object. (function( window, undefined ) { // Define a local copy of jQuery var jQuery = function( selector, context ) { // The jQuery object is actually just the init constructor 'enhanced' ...

help me understand JS execution on onclick event of button

<input type="button" name="reset" onclick="return ValidateValue(); __doPostBack('ApplyBtn','')" /> The above is the code generated for asp server button button control on browser. Now my query is that irrespective of ValidateValue() returning true/false __doPostBack('ApplyBtn','') function is not showing any effect for me. My...

Drupal dynamic field type toggle

I have a form field in Drupal which I need some help with. The requirement is to have the field show up as a simple input field, but to have a toggle button against it which would convert it into a multi-line text box for users who wish to enter more data. In traditional PHP/HTML/Javascript this would be dead easy -- two fields; one st...