javascript

javascript match isn't greedy

given text:1,0397,030 followed by nothing or any number of characters not in the set [,0-9] why is my regex not being greedy enough? Javascript's regex is supposed to be greedy by default, right? but text.match('[,0-9]+'); pulls back 1,0397 instead of 1,0397,030 var matches = shortInput.match('[0-9]+[,0-9]*[0-9]*'); works. This is in...

jQuery - Programmatically Trigger Event

I need to programmatically trigger a click event that's being handled by jQuery. Here's the current code: var $thumbs = $('#PhotoGalleryThumbs .tile'); var $zoom = $('#PhotoGallery #PhotoGalleryZoom img'); var $description = $('#PhotoGallery #PhotoGalleryDescription'); $thumbs.click(function(event) { event.preventDefault(); va...

Is there was way to get the leftmost column in a Google visualization table to stay fixed while side-scrolling?

I'd looking to emulate the standard google visualization table header row behavior, but have it apply to the first column. This doesn't seem to be a built-in feature, but I'm wondering if it can be accomplished with some custom CSS? ...

save to sql server database from client side

I have a gridview with dropdownlist in it. When the user changes the item in the dropdownlist I want to save the new item in the database. I want this to happen using javascript and ajax like effect. I know how to access the dropdownlist inside gridview using javascript and I can get the new selectd item. How can I save it to databas...

Adding links to this PHP statement

Here is a PHP statement that basically sets off a javascript image slider. Only problem is I can't figure out how to get each individual image to a link to a different page. Any tips or suggestions? I appreciate it! <?php jsbrotate('height=316&width=924&imgdisp=4&imgfade=2&images=/wp-content/uploads/image_1_linked.png|/wp-content/upl...

Using JavaScript's split to chop up a string and put it in two arrays

I can use JavaScript's split to put a comma-separated list of items in an array: var mystring = "a,b,c,d,e"; var myarray = mystring.split(","); What I have in mind is a little more complicated. I have this dictionary-esque string: myvalue=0;othervalue=1;anothervalue=0; How do I split this so that the keys end up in one array and th...

How do I submit disabled input in ASP.NET MVC?

How do I submit disabled input in ASP.NET MVC? ...

How to create an object from the location/URL value in JavasScript/Jquery

I need a way to create an object from a location value. For example if I have the value: 'http://www.legis.state.pa.us/cfdocs/billinfo/bill_history.cfm?syear=2007&amp;sind=0&amp;body=*S*&amp;type=B&amp;bn=1' which I get from doc.location.href(); I would like to make the following object: myObject = { syear : '2007', snid : '0'...

How to change behavior enter/backspace pressed in WYMEDITOR

Hi all, In Google Chrome after pressing enter key in WYMEDITOR a new <p> is created. How to change it? I would rather insert <br /> tag as it happens after shift-enter combination. (In fact shift-enter creates two <br />). Similar question concerns backspace pressed on the beginning of paragraph. How to change this behavior to erase p...

Problem with IE

I have the following code: function header(){ experience += ''; var expimage = ''; for(var cik=0;cik<experience.length;cik++){ switch(experience[cik]){ case '0': expimage += 'img0'; break; case '1': expimage += 'img1'; break; case '2': expimage += 'img2'; break; case '3': expimage ...

API access to a manually-created Google Map

I have a number of public custom Google Maps created via http://maps.google.com/ - obviously associated with my google account. Can I access these maps via the Google Maps javascript api? The api doesn't appear to work with the manually created maps located on maps.google.com from what I can tell? And if not, is there another way to s...

JavaScript - Basic URL rewrite + creating record in history

Here's the situation. I have a site where clicking hyperlinks within a certain div makes a jQuery function get the content of a div from a separate page. Because of this, the URL don't change. I need it to change as well as writing an entry in history. My pages are setup like this (not sure this is the smartest way of going though) a...

JQuery: $(this).text('some_text'); is causing my link to have a border

I have the following code: $('a.btn-slide').toggle(function() { $("#SliderDIV").slideDown("fast"); $(this).text('Hide/Show'); }); Only in Firefox, when I click the a href link to hide/show the DIV, Firefox display a dotted border around the href link (which I don't understand why and it shouldn't be). However, in IE and Chrom...

What broke in this Javascript 1.2 snippet?

A friend has pointed me to his old website and says "the submit form just stopped working a while ago. I'm sure it's something simple." The form asks a child for a certain word from a book, and based on the answer, it should redirect the child to a success page or a failure page. It's using Javascript 1.2, circa 2001. You can see...

Using jQuery to set/retreive multiple key/value pairs in one cookie using an array.

My goal here is to cut down the number of cookies I'm using to store things like persistent states into a single cookie by setting and retrieving multiple key/value pairs within a single cookie using an array. I'm mostly interested in knowing if someone else has already done this and has written a plugin for it, as I would think this ha...

how to set form action through javascript?

I have an html form whose action should be set dynamically throught javascript. How do i do it? Here is what i am trying to do: <script type="text/javscript"> function get_action() { // inside script tags return form_action; } </script> <form action=get_action()> ... </form> ...

Hy, problem mantaining big javascript code.

I have more than 1000 lines in a big jquery plugin, that is actually a big class, that inludes some others classes, but they have to be in the same file. I inlcude a piece of code. If you have another way to simplify the code.. The actual problem is that i have a gallery with a lot of things, is dynamic with smart ajax data loading so i...

Standalone jQuery "touch" method?

So, I'm looking to implement the ability for a plugin I wrote to read a touch "swipe" from a touch-capable internet device, like an iPhone, iPad or android. Is there anything out there? I'm not looking for something as full as jQtouch, though was considering reverse engineering the code I would need out of it. Any suggestions on the be...

Howto get html popup inside svg at correct position (using javascript)

I have a simplr svg-graph and I'm trying to create a simple tooltip-popup for this graph, but I'm unable to find out how to set the position of the tooltip properly. I have a .css where my popup-div is absolute: #popup { position: relative When creating nodes in the svg I hook a listener like: p.setAttributeNS(null,"onmousem...

Passing variables to shopping cart with Javascript

This question is an extension of this one: http://stackoverflow.com/questions/2359238/calculate-order-price-by-date-selection-value I'm trying to make a conference registration page based off the previous page, which passes the variables(name, email, price) to my organization's outdated shopping cart using javascript. I'm also using Se...