javascript

cross site scripting in JavaScript

I am trying to resolve a cross site scripting exception in my code. I'm getting an XSS error at line where I was using JSP expression inside a JS code ex: inside a JS function function ex(){ ..... var loc = '<%= location.getLocDetails()>'; ..... } Please let me know, if you have any solution/workaround? Note: location.ge...

Replace page content before file loads?

Hi! I wanted to know, is there any sory of scripting that I can use so that I can simply change one little thing and then the content will change for multiple pages? Maybe PHP or the htaccess file. What I want to do is make an "Under Construction" page for my website, that I can periodically turn on or off. Right now, the method I am us...

loading value to asp.net control using javascript

hi iam into problem of reading the value of the control which i alterd using javascript the sequence goes like this i got the text box control by using its id cleared the value of the text box make the control disabled. when i tried to retrive the value of the textbox in aspx.cs iam still getting the old value of the text box which i ...

PHP loop inside Javascript at header - is this code valid at all?

Hello Dear StackOverflowers, I am new to web programming and finding the server-client mixture confusing. I have written very simple code which accepts a PHP 2D array [index][keys] (from a query) to just draw markers on a Google map (JavaScript). It works. But it doesn't look right to me! Is this indeed the correct way to pass the val...

jQuery lightbox plugin that scrolls with the page

Some of the JavaScript lightbox effects that I've seen position the lightbox relative to the viewport, so that when you scroll the page you will still see the lightbox. The other kind are the ones that are positioned relative to the page contents. If you scroll a page containing one of these, the lightbox moves with the rest of the pag...

What is the way to access IFrame's element using Prototype $ method

Using prototype js library I can access elements by using $(elementID). I can access the element in an Iframe by $('iframeID').contentWindow.document.getElementById('ID of element inside Iframe'). I would like to use the same dollar method for my Iframe to access elements in Iframe. Is there any way? ...

Static code analysis tools

Whether JavaSript, C# or C++ main problem i face while reading the code is which function is called by which function. This problem is big when dealing with BIG code. Is there any static code analysis tool/technique/plugins using which a graphical representation of the code can be generated(something like below) so that reading/analyzing...

How to inherit from a class in javascript?

In PHP/Java one can do: class Sub extends Super { } And automatically all public/protected methods, properties, fields, etc of the Super class become a part of the Sub class which can be overridden if necessary. What's the equivalent for that in Javascript? ...

jQuery - expected identity or string

Hi, I fårexpected identity or string on the "if (vContains (gMouseoverBox) == true) (" to What is the reason for this? var pProjectID = "static"; var gMouseoverBox = pProjectID + "_IF"; var arrBoxesNotMouseOvered = []; function vContains(pName) { for (var i = 0; i < arrBoxesNotMouseOvered.length; i++) { if (arrBoxesNotMous...

Root Nodes in JSON

I'm tasked with defining communication between two web apps. I've decided to use JSON for this. How common is it to have a root node in the JSON? Let's say we have a car object. This is the JSON with "Car" being the root node: {"Car": { "Make":"Mustang", "YearBuilt":"1999"}} So now let's say I have a Tire object and since w...

Implementing instance methods/variables in prototypal inheritance

I've been playing around with prototypal inheritance after reading http://javascript.crockford.com/prototypal.html and having a bit of a problem with understanding how I could make use of it in the way I would use classical inheritance. Namely, all functions and variables inherited by the prototype essentially become statics unless they ...

how to implement a jQuery live bind event on mootools?

How do I make elements that are loaded via ajax, adopt the events associated with the same class on mootools 1.11? As far as I know, in jQquery, if your ajax response consists of something like <div class='button'>, if there is an event bind using live to $('.button'), those events would automatically bind. Is that possible with MooToo...

Sending big data to server, Cross-Domain

I'm trying to send chunks of data from many different servers my app is on, to mine. Using some dummy image source, passing my data as a GET query. (img.gif?aaa=xxx&bb=yyy...) the Query is many times too long and gets cut. is there some better way for me to send the data cross-browser? ...

jQuery - LavaLamp menu with multiple images?

Hi, I'm trying out the jQuery Lavalamp menu and I'm trying to alter it and understand how it works at the same time. Thing is, all examples I've found consist of basically two images. The background and the left image. That ok, but I want to create a menu where it consists of three images. The background, the middle and the left. And t...

doesnot show select value

Hi All, I am trying the jeditable jquery plugin on a raw html. What has happened is it doesn't store the selected value. When I select ay value from the drop down menu the value doesnt reflect instead "Click to Edit" comes up. I am stuck please help. Following is my code: <head> <script src="http://ajax.googleapis.com/ajax/libs/jquer...

Adding ajax loading gif to script

Hi one and all, Thanks for looking, I have the below script that updates a series of drop down boxes, populated depending on the users previous answer. Data comes from SQL tables. I was wondering how I could add an Ajax loading gif to each drop down while the data is loading. I hope this makes sense, if not please ask. <script language...

How to POST Data to another web application using REST or otherwise

Hi Please consider the following scenario, There are two web applications App1 & App2. A user would submit his information on App1 though a form. On click of a specific button/link on App1, the same data should be posted to a page on App2 and the user should also be redirected to the same page on App2. I would like some help in find...

html select label based on value in java script

Can I get html select option label based on option value <select id="xx"> <option value="i_Have_value">I Need This Label</option> <option value="i_Have_value2">I Need This Label2</option> </select> By using jsf selectOneMenu and rich:comboBox in single form, i landed up in this kind of requirement. ...

Javascript Array Problem

Why is JavaScript returning the wrong array length? var myarray = ['0','1']; delete myarray[0]; alert(myarray.length); //gives you 2 ...

Arbitrary precision Float numbers on JavaScript

I have some inputs on my site representing floating point numbers with up to ten precision digits (in decimal). At some point, in the client side validation code, I need to compare a couple of those values to see if they are equal or not, and here, as you would expect, the intrinsics of IEEE754 make that simple check fails with things li...