javascript

How to generate sequence of numbers/chars in javascript?

Hi, Is there a way to generate sequence of characters or numbers in javascript? For example, I want to create array that contains eight 1s. I can do it with for loop, but wondering whether there is a jQuery library or javascript function that can do it for me? Thank you ...

issues with getting multiple select param values from jquery, javascript back to perl cgi page

Hi, I have been working on this for 1 hour with no such luck. Any help would be appreciated. I have a cgi script with which creates these select param values: print "Please select a dkversion to compare : <br><br>"; print "<select name='dkversion' id='dkversion' size='6' multiple='multiple'>"; foreach my $values ('ASDF123GS v0.01 mod...

Removing GPolylines using google maps

I have a point where a Gpolyline line is drawn from a marker to another point. After I click on it a second time, I want to remove the polyline. How do I remove the line after clicking on the marker a second time? My pseudo-code is as follows: google.maps.event.addListener(markersArray[0], 'click', function() { 'draw line to po...

Register JavaScript from within a UserControl in ASP.NET

I declare my javascript in the design page of a usercontrol (ascx). Is there a way to register this javascript block in the Head section? I don't want to use ClientScript.RegisterClientScriptBlock as I don't want to declare my javascript in the code-behind. I also cannot move it (entirely) into a separate file, because I use business log...

Where to add jquery "this"?

$(window).load(function() { var paircount = 0; var $thisSprite = $("#%id% img.imageStyle"); if ($.browser.msie) { // I need this only if desaturate png with aplha channel $thisSprite = $thisSprite.desaturateImgFix(); } // modified not to desaturate the clone $thi...

How to use a regular expression to find delimited needles within a haystack in Javascript?

In Javascript, how can I use a regular expression to iterate through a string to isolate all occurances of strings starting with a '{' and ending with a '}' character? So, for example the haystack string may be: Lorem ipsum dolor {sit} amet, consectetur adipiscing elit. {Praesent} tincidunt, sapien non ultricies posuere, justo felis {p...

Write extra spaces to html element with JavaScript

We have JavaScript that writes to the document title and attempts to pad it with extra spaces... document.title = "My Title&nbsp;&nbsp;" But this gets translated to "My Title&amp;nbsp;&amp;nbsp;" Anyone know how to prevent this? ...

Change inline JS to click function in jQuery

Trying to clean up some code. I have a button that has the following inline JS <input id="lookup" type="submit" name="lookup" value="Search" onclick="changestart('1')" /> I would like to change the onclick to a jQuery click funnction but am getting no success. Here is the "changestart" function function changestart(direction) { v...

Strange Ajax behavior in JQuery in Opera and Chrome.

I have this functions //send JSON-RPC request var json_rpc = (function() { var id = 1; return function(url, method, params, success) { if (typeOf(params) != 'array') { params = [params]; } var request = JSON.stringify({ 'jsonrpc': '2.0', 'method':...

How to extract r, g, b, a values from CSS color ?

What would be the easiest way to transform $('#my_element').css('backgroundColor') to object like this: { r: red_value, g: green_value, b: blue_value, a: alpha_value } ? ...

Javascript windowwidth - resize

Hi guys. I'm trying to figure out with this isn't working. It used to take care of height instead of width, but i simply can't get it it work. Anyone could point me in the right direction of the problem perhaps? function getWindowWidth() { var windowWidth = 0; if (typeof(window.innerWidth) == 'number') { ...

How can i get jquery countdown to redirect to a reset file

here is my countdown $('span.countdown').each(function() { var endtime = $(this).html(); $(this).countdown({ until: endtime, format: 'dhmS', layout: '{d<}{dn} days {d>}{h<}{hn} hours {h>}{m<}{mn} mins {m>}{sn} secs', expiryUrl: self.location.href }); }); } i ...

Mobile Safari - Show console?

To prevent the default scrolling of a page I'm adding an event listener for "touchstart" events on the body and calling event.preventDefault() This works fine but I now can't access the debug console as it requires a page drag? Has anyone else had this problem and come up with a work around? ...

Jquery: Small bind hover/unbind snippet of code, few lines long, don't know what's wrong.

I've created DIV.cb-toggle, when the user hovers over this div, it animates to Orange, when they hover off of this div, it animates back to gray, when the user clicks this div, it animates to blue, telling the user that it's been selected. So when it's NOT selected, it has mouseenter mouseleave animations, but when it's selected i want ...

Grid text box stretchable

Hi, I am not able to make my jgrid text box draggable. How can I make it draggable? Please help. Here is my code. jQuery(document).ready( function() { //debugger; var lastsel3; jQuery("#test").jqGrid({ url:'/Content/xml/user.xml', //url: $!retrivexml, datatype: "xml", colNames:['Consultant','Project R...

How to validate all fields with the same function in JavaScript?

Hi. I need to do the following, but I couldn't find any example of similar form validation on the web: <script type="text/javascript"> function something(){ if the value on the field who is calling this function == 2,4,6 or 8 alert("This number is invalid") focus in this field. </script> Field1 call something() Fi...

Javascript Bug Report

Is there any javascript framework for reporting bugs? I'd like to be able to get a copy of the web page the user is currently looking at plus maybe a stack trace on the JS, their current browser etc. and post it to my web application so that when I try to debug the application I spend less time trying to recreate the issue. ...

Facebook: How to build a basic app inside FB with iframe, javascript, and openauth

Facebook: How to build a basic app inside FB with iframe, javascript, and Graph API I've previously built an FB app with FBML and PHP, but everything feels so different with the new way they're doing authentication and everything. There's no "Building Apps the New Way 101" guide either that I can find. How do you build a classic FB ap...

One form, multiple submit buttons and submit links

Hi, I have web form with multiple submit buttons. To determine which button was pressed, each has a different name, like so: <input type="submit" name="foo" value="Foo Foo"> On the form there are also normal links that act as submit buttons, like so: <a href="" onclick="parentNode.submit();return false;"> Bar </a> My question is h...

HTML5 Geolocation is so slow! what I'm doing wrong?

this is my simple code I'm using in a test page: but it takes ages to find the address...how come? am i doing something wrong? <script src="http://maps.google.com/maps?hl=it&amp;amp;file=api&amp;amp;v=2&amp;amp;sensor=true&amp;amp;key=*xxxxxx*" type="text/javascript"></script> <script type="text/javascript"> var map; var geocode...