javascript

how do i submit a form using get method in jquery

I am aware of sending form values using the method=get <FORM METHOD=get ACTION="test.html"> I have a textbox which captures email. When i submit form using the GET method the @ is converted to %40. I had read somewhere that Jquery could send the data across by serializing. How can it be done? Thanks ...

js render loop that breaks once a condition is met

How do I set up a setInterval render loop that breaks, once a condition is met? ...

javascript document.write breaking my page

I have this response.write on my page function roundthecon() { document.write(Math.round(exchRate*Math.pow(10,2))/Math.pow(10,2)); } But it is re-writing my whole page and replacing it with the rounded number is there any other way of doing this without it re-writing my page? Thanks Jamie UPDATE Full javascript if (exchRate != "...

Convert HTML website with Facebox to .NET for form handling

My website was designed without any backend in mind. Facebox was the chosen plugin for the screen pops for features like logging in, registering, searching, etc. What is the easiest way to convert this to .NET? I don't care if it's web forms or MVC (I suppose I would prefer MVC). Most of the Facebox div's are in separate .html files. For...

Can I add a method to a closure

This is sort of what closures are meant to avoid, but I'm wondering if there's a way to a add a method to a closure. Basically I have a js file library that I'd like to augment for a specific client by adding a new method. I have a js file called library: var LIBRARY = (function(){ var name; return { setName: function(n) { name = n; }...

overriding a global function in javascript

I am trying to add my own error handling to the JavaScript setTimeout function. The following code works fine in chrome: var oldSetTimeout = window.setTimeout; window.setTimeout = function setTimeout(func, delay) { var args = Array.prototype.slice.call(arguments, 0); args[0] = function timeoutFunction() { var timeoutArg...

Javascript events

Hi folks, I am completely confused here. So I am looking for a solution for the following problem: I want to trigger some function(for now an alert box) using jQuery on an input field. Conditions are: Input field always maintains the focus. Input is fed from a USB device, which acts just like a keyboard input. So for 10 characters, t...

How can I replace a standard textarea with "insertable" text fields?

Hi all, I'd like to be able to replace a standard HTML <TEXTAREA> input with insertable <INPUT> text inputs. By insertable, I mean having two TEXT form inputs (name, role) and an "Add" button after it to add a new name/role after this one if desired. Ideally I'd have 'role' in an HTML <SELECT> input (drawn from my database) but I'm not...

How to write this crawler in javascript ?

The idea is very simple: Imagine a simple white page with a form with a single input tag ( like google homepage ). When I insert a link of a blogpost in this form, then the javascript-crawler search the first image in the webpage of the blogpost ( through ajax ), show it in the white page and save it on my server. This crawler works li...

how to fetch value from <select> tag

I have a list like <select name="operation" id="operation"> <option value="1">XXXX</option> <option value="2">YYY</option> <option value="3">ZZZ</option> </select> I have to get value "XXXX" if user select an option 1, for 2nd I have to get show "YYYY" and so on. And format should be like in the above means i don't have to chang...

scope of stopEvent

how can i call stopEvent within init? testObj.prototype = { init: function(wrapper) { wrapper.onclick = function(e){ stopEvent(e); //getting error stopEvent not defined }; }, stopEvent: function(e){ if(e.preventDefault) e.preventDefault(); else e...

Facebook access token issue in JS implementation

I am new to FB apps and trying to get the accessToken for my website using JS. I have followed the steps given on the API docs, but I keep getting an "error": { "type": "OAuthException", "message": "Error validating application." } I know that theres some issue with my implementation. Can someone please help me out. If...

Problem with Data Output

Part code: google.load("language", "1"); function initialize() { google.language.translate("$text", "ru", "en", function(result) { if (!result.error) { var container = document.getElementById("translation"); container.innerHTML = result.translation; } }); } google.setOnLoadCallback(initialize); </script> .......

How can I call a dynamically added javascript function from a child window?

Parent page (opener): function getData() { var script = "<script type=\"text/javascript\">function runFunction(){alert('Hello world');}<\/script>"; return script; } function sendData(elem, data) { $(opener.document).find('#' + elem).append(data); opener.document.runFu...

jquery selector help

I have a div with an id="my_div". How can I find a <select> by name (i.e. name="my_select") assuming that the <select> can be at any level underneath the div? I.e. it can be a child, grandchild etc. Ultimately I need to get the value of the selected option. ...

Ajax GET request turning into OPTION request

I'm experiencing a weird behavior with an ajax request on a godaddy shared linux server. The request works perfectly on many other servers I've tested it on, but on this one, the GET request turns into an OPTIONS request for some reason. Here's the js code (using mootools 1.1): var a = new Ajax(myurl,{ method: 'get', ...

Javascript Events: How to trigger event when ALT+NUM character is entered

I first used the onKeyUp event to detect input changes in a textbox. However, when the user enters in a French character using ALT+Num, the event doesn't detect the change until i enter the next character... Which event should I be using to detect the special character changes. I've tried onChange but does not seem to be working. I've ...

Best approach to remove special characters using ColdFusion and Microsoft SQL?

I want to remove all special characters (",/{}etc.) from an input field being saved as a string to the DB. What is the best approach? Should this check be tackled with JS, ColdFusion or Microsoft SQL - Maybe all three? How would I go about coding this using ColdFusion or Microsoft SQL? ...

Blackberry - How to give a textbox focus on load

I'm trying to add some additional usability to our web app for our Blackberry users and am currently having issues getting a textbox to autofocus on load. Currently I'm using the standard .focus() javascript call on the element which works fine on everything but a blackberry. On the blackberry it seems to select the textbox than instan...

Having a child page resize parent without invoking parent hosted script?

I currently have two html pages, a server hosted page, and a client hosted page, both on the same domain. The server page, has an iframe sourcing the client page. I want the parent page iframe to resize based on the child pages content. To accomplish this I have a bit of javascript that sits on both pages. The client(child) page determ...