javascript

Ajax responding too quickly?

I have a jquery function that hooks a javascript function when my form table is created, only it seems to respond too quickly. My function being called is: function ValidateForm(CQID) { var dt=document.newDate.txtDate; if (isDate(dt.value)==false){ dt.focus(); return false; } populateDateTable(dt.value, CQID); ...

How to implement optional parentheses during function call? (function overloading)

My guess is that this is not possible, but I'd like f and f() to do the same thing. var f = function(str){ console.log(str||'foo'); }(); f; // wanted output: 'foo' f(); // wanted output: 'foo' f('bar'); // wanted output: 'bar' Because f is no longer a function definit...

Scroll if on the right side (jQuery)

Hi all, i have create a gallery with jquery. http://www.rialto-design.de/endkunden/galerie/galerie-armaturen/?album=3&gallery=2 so my question is, how can i make the thumbs scroll left or right. when the cursor is on the right or left side of the container. Important is, the thubs are still clickable. Thx ...

Event for radio button being selected?

Is there some event for a radio button being selected? I know I can use "click" but I believe it is possible to style radio buttons in some browsers such that clicking an outter area of a radio button might not select the radio button. What event should I use? ...

prototypejs : holding functionality till ajax request result come.

i am using new to prototype and using its ajax functionality but not able to set the values to return type my code is var captchaRequest = new Ajax.Request('http://www.example.com/captcha/validate.php', { parameters: "captcha_code="+captcha_code, onSuccess: function(result) { if(result.responseText == 'true') { retur...

How can I load an iframe with JavaScript?

hi to all i am using jquery and php. i want to open iFrame when i change product id in browser url. can any one help me "how to get id from browser window even i manually change the produt id ". and open iFrame. Thanks ...

Proper way of calling a Javascript method

Is there a reason why I should call a Javascript method as follows: onClick="Javascript:MyMethod();" or can I just call it like this: onClick="MyMethod();" Is there any difference? ...

Passing a function in Jquery / Javascript

Good afternoon people's I have built a jquery plugin that I use on my site. The plugin is for suggestive input boxes and works fine. One thing I need to add to it is the ability to pass a function in it's config to apply to the response of the ajax call that is made for the suggestive. I can't find anything on trusty old google about h...

Broken jQuery 1.4.2 functionality ?

This code worked prior to the upgrade from 1.3.2. to 1.4.2 and now I'm getting this error I don't know what to do with...: jQuery.ajax({ type: 'post', url: '/ajax/store/product/getAssocDetail.ph', dataType: 'json', data: { //productId: (document.location+"").split("=")[1], vehicleId: id }, success: function () {/* ...

Javascript RegExp replace with negative lookahead

Hi, I am trying to replace some value in the query string of the current page using JS. Eg: from category=Old Value to category=New Value. To code looks like this: var sNewValue = 'New Value'; sQueryString = sQueryString.replace(/category=[^&]+&?/, 'category=' + sNewValue); It works fine except for values that have ampersands. Luckil...

javascript array index test

if I have an array myArray which I am looping through: for(var i=0;i<myArray.length;i++) { if(myArray[i] == myArray[i+1]) //do something } Clearly, myArray[i+1] will fail on the last iteration. Short of testing if i == (myArray.length - 1), is there a clean way to not fail on that if statement and just have it evaluate to fa...

Memory issue - Does Webkit cache CSS styles of elements?

Hi I am running into a memory issue with webkit browsers on Windows with my current project. I will first describe the project I work on, then describe the actual issue. Please take my apologies for the long text, I hope it's not too much.. I am working on a project that lets you view a printed magazine online. For iPad support it is d...

Context on facebook api callback?

Is there a way to pass context in a javascript facebook sdk api callback? Here's a simple exemple. Now this won't work because the variable 'this.name' in my callback function would be undefined, because it's not in my user object context. Any idea how to do it? function user(id) { this.id = id; this.getUserName = function(fields,ca...

how to call php function in JS?

Hey there i have a php cart that i have done using class and functions, and when it came to deleting a selected item or all items, i wanted to use JS to do it, is there any way to accomplish it. ...

ASP.NET MVC AjaxForm onFailure - How to display error?

I have an Ajax Form that looks like this: <% using (Ajax.BeginForm("Update", new AjaxOptions { UpdateTargetId = "message", InsertionMode = InsertionMode.Replace, OnSuccess = "success", OnFailure = "error" })) { %> I can get "error" to run on a failure but i would like to alert the error message. How can i get this information...

Adding alert() make "not working script" work properly

I have a to rewrite code written couple of years ago to work with modern browsers. That site includes couple of Javascript files. In on of them there is a code something like this - it's generating DOM elements dynamically: createTabs(); createTabsContent(); Now, I'm opening site in Chrome and after page is loaded I try to change so...

Internet Explorer unwanted artifact on images when using javascript slideshow

Hi there, We're having the following weird (well...) behavior in all versions of Internet Explorer browsers when using javascript slideshows. You can see what I mean here http://www.tospirto.net/index.php?ID=photo_gallery&amp;Rec_ID=481 In the last 3 images there are white lines and artifacts created by the browser. This is true as I ...

Receive callbacks from HtmlPage host in Silverlight

I'd like to receive callbacks from Javascript code to my Silverlight host without using ScriptableAttribute. I've seen it done before, but I couldn't work out how they did it. Has anyone got any ideas? Thanks ...

How to Get Text Node with Dojo JS

I am trying to get the text from within a tag - but that tag has a nested node, too which I don't want. How do I just get the text? For example <div id="i_want_the_text_in_this_div"> <span id="but_not_this_one"> ignore this text </span> keep this text </div> ...

Implementing reCaptcha ajax api to an exiting webform that already uses ajax

I have a signup form on my home page which uses server side validation and ajax so my page doesn't refresh while validating. When all validation is passed my page is taken to a registered.html which is a temporary page for now. Later on it will be an account area. What I want I want to have 1 last step after the actual form validatio...