javascript

Javascript question on functions..

In my main Web Page (Viewer.aspx) I have a javascript script tag like this <script language="javascript" type="text/javascript"> function initialize() { var map = $find('Map1'); map.add_mouseMove(mouseMove); } </script> Within those script tags I have a function. Is it possible to call another function tha...

Highlighting text beween custom tags

In a xhtml, i want to highlight the text between two self closing tags s1 and s2 whose attribute "ind" has the same value. Eg. <s1 ind="1"/> and <s2 ind="1" /> Eg. <html> <body> <a> <b>Some <s1 ind="1"/> text></b> <c>data <s2 ind="1"/>here</c> </a> </body> </html> I want "text data" to get highlighted. Is is possible to achi...

JavaScript - Storing data during user interaction

I'm working on a web based form builder that uses a mix of Jquery and PHP server side interaction. While the user is building the form I'm trying to determine the best method to store each of one of the form items before all the data is sent to the server. I've looked at the following methods Javascript arrays XML document Send each fo...

slide div from bottom to top using javascript

Hi All, I have a login button at the footer of my main page or landing page.Currently when user click on the button a login form will get open from TOP to BOTTOM i.e. from the start of form to the "LOGIN" button.What i want is that when i click on the login button it should open the form using slide effect but from the BUTTON to the TOP...

Extract external javascript query string/anchor value: file.js#foo=bar

http://mycloud.net/js/file.js#foo=bar I'm trying to load a cross domain javascript file, and want to pass a variable along on the query string. I have seen the above '#' method used, but am unsure of how to extract the 'foo' value from within the file.js. Any clues how to handle this without the aid of server side help? Thanks. ...

ASP MVC add textboxes with jquery

I am new to jQuery, but I would like to have a button that when clicked will add more textboxes to a page. I have three textboxes that contain data of the same type and if the user has more data of the same type to enter, I would like to pop up three more textboxes. What would be the best way to go about that? ...

Need help to log the function body using firebug

When we use the console.log(someObject.someFunction) firebug shows function() string only. Is there a way i can see/log the code for the function in the console window ? Something similar to what we can achieve using alert(someObject.someFunction) shows the function body. ...

Remove/add text based on user selection from drop drown w/ Jquery

I just need to add an asterisk to the end of some text based on a user's selection from a dropdown field. If the user select's option one from the drop down then the asterisk is attached and if the user selects the second option than the asterisk is removed. I think I need to do this with jquery but I am having trouble figuring out which...

Convert JSON flattened for forms back to an object

I am required (please therefore no nit-picking the requirement, I've already nit-picked it, and this is the req) to convert certain form fields that have "object nesting" embedded in the field names, back to the object(s) themselves. Below are some typical form field names: phones_0_patientPhoneTypeId phones_0_phone phones_1_patientPh...

Canvas and HTML5: Supported Browsers?

I am looking at using HTML5 Canvas element for my upcoming project. I want to know what all major browsers (including the versions!, cos i know that the latest builds do support canvas) support the Canvas tag. I don't give a damn about IE. So don't bother reporting IE. :) In this tutorial Drawing shapes - MDC, the quadraticCurveTo secti...

Why are configuration arrays acceptible parameters in PHP and Javascript?

In most other OO languages it would be sacrilege to have each function receive a single associative array of Objects rather than enumerating each in the method signature. Why is it acceptable and commonly used in most popular frameworks for both of these languages to do this? Is there some justification beyond wishing to have concise m...

Question about [literally] mapping location based on an IP address.

I've been bored lately and I want to start a new project. I was looking at a website mentioned in a different question (http://www.grapevinegame.com/), and I thought the map and how it plots a point based on someone's IP (I assume) is pretty nifty. I want to do something like that, but I have no idea how it's done. I know you can get lat...

How do I loop through elements inside a div?

I have to make a custom function for search/replace text, because firefox counts text nodes differently than IE, Google Chrome, etc.. I am trying to use this code, that I saw at Firefox WhiteSpace Issue since in my other function, I am looping numerically through nodes, which serves my functional needs perfectly, in other browsers. But...

How to declare and use the name of a function from a json object?

Hello, I have a json object collection of geo locations that I build in the server. Each of those objects has two properties: "marker" and "onClick". Marker is for storing a Google Maps marker object and the onClick stores the name of the function to be called when that marker is clicked on the map. When I'm pushing the location obje...

Is it possible to write a javascript SSH client that uses web sockets for transport?

Would it be possible to write a basic SSH client in pure javascript using something like orbited web sockets as the transport layer? I don't see any examples of this, but it seems like it would be a nice thing to have. ...

Flash/Javascript upload in spite of same origin policy

Can one upload files to a domain other than the domain a script originates from? For example, suppose you're hosting files on www.example.com, and you want to upload files to uploads.example.com, would the following script violate the same origin policy (using uploadify): <!-- from http://www.example.com/upload.html --> <input id="file...

How is a functional programming-based javascript app laid out?

I've been working with node.js for awhile on a chat app (I know, very original, but I figured it'd be a good learning project). Underscore.js provides a lot of functional programming concepts which look interesting, so I'd like to understand how a functional program in javascript would be setup. From my understanding of functional pro...

drag and drop file attachment to browser, how do they do it?

drag and drop file attachment to browser, how do they do it? It seems gmail just starting this feature, and it doesn't require you to install any plugin etc. it works in both firefox and chrome but not IE. ...

How to POST data to an HTTP page from an HTTPS page

I know this is a long shot, but I figured I'd ask the question anyway. I have an HTTPS page and am dynamically creating a form. I want to POST the form to an HTTP page. Is this possible without the browser popping up a warning? When I do this on IE8, I get the following message: Do you want to view only the webpage content that w...

how does memory stacks work in javascript

When we have code like: function a(){ var x =0; this.add=function(){ alert(x++); } } var test = new a(); test.add(); // alert 0 test.add(); // alert 1 test.add(); // alert 2 How does this work? Doesn't that the value of 'x' in a() should be 'gone' as soon as test = new a() is complete? The stack contains x shoul...