javascript

Is there a way to customize/override assignment operations in JavasScript?

Every time I assign a string, I'd actually like to assign a string object, without the extra code. This var foo = "bar"; becomes var foo = new String("bar"); Basically hi-jacking the assignment. Follow-up: If the above is not possible is there a way to prototype the string variable type, rather than the String object? As ...

Multiple inheritance in javascript

Here's some question about oop in js (questions in the code below). <html> <script> function A(){ a = 'a - private FROM A()'; this.a = 'a - public FROM A()'; this.get_a = function(){ return a; } } function B(){ this.b = 'b - private FROM B()'; this.a = 'a - public FROM B() '; ...

Stop the timer / Automated flow when user clicks on any digit.

I have a slider that rotates between different divs nicely with the following code: <script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.4.2/jquery.min.js"&gt;&lt;/script&gt; <script type="text/JavaScript"> $(document).ready(function (){ function showSlide(integer) { $('#myslide .cover').css({l...

Problem configuring ContentFlow

I'm trying to setup a simple slide show using ContentFlow javascript (http://www.jacksasylum.eu/ContentFlow/index.php), and I know I'm missing something very simple - I can't seem to control the size of the images in the slideshow. It automatically scales them to the device I'm viewing them on, but on a higher res monitor it just looks w...

Wild Card in Javascript Bookmarklet

Is there a way to use a wildcard in a javascript bookmarklet? For example, I have this: javascript:(function(){var b=document.getElementsByName('send');for(var j=0;j<b.length;j++){if(b[j].value.match(/^Send Pattarapim a Thank you gift$/i)){b[j].click();break;}}})() That worked great when the item was for "Pattarapim". But that "na...

Visual Studio 2010 Deployment package

I want to use this task in the VS2010 Web Application package deployment process to compress the javascript files: <Target Name="CompressJS"> <ItemGroup> <_JSFilesToCompress Include="*.js" /> </ItemGroup> <Message Text="Compresing Javascript files $(_PackageTempDir)" Importance="high" /> <JSCompress Files="@(_JSF...

Programatically disabling jQuery client validation in ASP.NET MVC

I am using the jQuery MVC validation library for ASP.NET MVC, which is working fine. However, on my form I have a 'Cancel' and a 'Save' button, both of which I want to submit the form back to the server. However, if the user clicks 'Cancel' I need to disable the client side validation so that the user doesn't get prompted to complete...

resize button image using javascript

I want the following button (and it's image) to change size when I click it. The dialog is showing, but the size is not changing.. <html> <input type="image" src="pacman.png" onClick=" alert('test'); this.height='200px'; // change de button size // this.image.height='200px'; // not sure if this line will wo...

Shorten JQuery Snippet

I have the following JQuery snippet: (someVar.next().length == 0)?someVar.fadeOut().end().find("ul").first().fadeIn():someVar.fadeOut().next().fadeIn(); There is a fair amount of code duplication between the two results of the conditional - i.e. someVar.fadeOut() and .fadeIn() on both. I would ideally like something like this: someV...

Can someone tell me the purpose of the second capture group in the jQuery rts regular expression?

In Jeff Roberson's jQuery Regular Expressions Review he proposes changing the rts regular expression in jQuery's ajax.js from /(\?|&)_=.*?(&|$)/ to /([?&])_=[^&\r\n]*(&?)/. In both versions, what is the purpose of the second capture group? The code does a replacement of the current random timestamp with a new random timestamp: var ts ...

Pass data from javascript to PHP in cakephp

Hello I have a select element which has a few options. I am able to get the selected option when an onChange event is fired. Now I need to pass that option text to php, either with pageload or ajax. echo $form->select('data_source_select',$dataSourceOptions,null,array('escape'=>false, 'empty'=>'Select One','onChange'=>'getData(this)'));...

How do I get a handle to a dynamically-generated field name in javascript?

I have a series of fields created dynamically based on database records. They will be named cardObject1, cardObject2, and so on for as many rows as necessary. I'm now trying to access a specific cardObject field in a function where the number is passed in, but am getting an error message. The field looks like this: <input name="cardOb...

Remove an element from find return

Hi, With the fallowing code I want to delete the last element inside the steps variable, var steps = $(element).find("fieldset"); var count = steps.size(); steps[count-1] = null; but when I iterate with the each method, it doesn't seems to see the null value steps.each(function(i) { }); ...

Return String Outside Ajax Request

I am pretty new to this, so go easy on me: I am building an image gallery with a main index page which allows users to select different categories of projects, a sub-index page which allows users to select specific projects within their selected category, and then the gallery page for that project. The code below is for the main index ...

append data is not showing? HELP!

im trying to append data using jquery, but its only showing the status messages but not the button! although the button deos show on firebug? $("form.follow-form").live('submit', function(e) { /* stop event */ e.preventDefault(); /* "on request" */ $(this).find('i').addClass('active'); /* send ajax request */ $.ajax({ ...

Problem invoking a function on change event.

Hi Folks, I am trying to invoke an ajax call as soon as my input fields length is 15 (for now I have just put in an alert box in place of .ajax{ }), but the alert box is not firing up until I click somewhere on the screen after input field is filled with 15 characters. what am I doing wrong here? $("#serialCode").change(function ()...

Force display text from Unicode in input field (from ajax)

Hello all, We are doing an ajax call to retrieve from database. Since our clients may use different languages we encode everything into unicode to store in the database (saves worrying about collations and such). Now when we fetch such content to be displayed in an input text field it is displaying the unicode codes. Checked the HTML 4 ...

Link open left div

Hi guys i have this link http://www.tgi.com.pt/link/tabSlideOut.html and my idea is the link content open the left div. But I can't doing the desired effect any suggestion? ...

handling strings with apostrophes passed to javascript generated by jsp and struts 2

in jsp i have <a href="javascript:toggle('<s:property value="company.name"/>')"> company names containing apostrophes are generated like so: <a href="javascript:toggle('apostrophe's company')"/> single quotes around names cause problems for company names with the apostrophes. i'd like to get double quotes around the names instead, ...

Fade from background-image to hover

Hi, I'd like to fade my first background-image into one that is supposed to be used on hover and then off again once the user removes their mouse. Can use jQuery. Here is what I have so far: <ul style="top: -70px; display: block; padding-left: 205px;" id="cats-menu" class="nav superfish sf-js-enabled"> <a href="http://www.ballp...