javascript

auto-size iframe cross domain

I am making a web widget using iframe and javascript and i would like to make my iframe resizable to it´s content (which is loaded from other domain). I have done some search(inclusive here at StackOverflow) and i find a couple of topics but i couldn´t find any conclusions about this issue. Is this possible or not? Because atm i have ...

jQuery Ajax success variable

Hello. I have the next function. My PHP script returns an array with element error with value 'ERR': var updatePaymentType = function(plan_pt_id, pt_id){ var error = null; var data = new Object() data["function"] = "update"; data["payment_type_id"] = pt_id; data["plan_payment_type_id"] = plan_pt_id; ...

How do browser-side javascript template engines render templates?

I found a large number of browser-side JavaScript templates which render a template with data values a string. However, I'm a bit uncertain how this string is supposed to be translated to display elements in the DOM. Obviously, one way is just document.write - but I think that has been long buried since. Another is using element.innerH...

Is there any way to fake the calling file in Firebug console?

Note: Firebug being Firebug extension and/or Webkit developer tools. With the faking of calling file I mean the link at the right side of the console output, pointing to the location where the output function (like console.log) is called. This becomes a problem when you have unified handler for error messaging etc, thus all the console...

ONLY Visible Div form elements will get submitted

I have used a JavaScript to hide the DIVs containing form elements.... <script type="text/javascript"> <!-- function showMe (it, box) { var vis = (box.checked) ? "block" : "none"; document.getElementById(it).style.display = vis; } //--> </script> When certain checkbox(s) are selected the respective DIV(s) are shown or get visible........

Checkable javascript table to display google map markers

hi, i would like to find a javascript that displays a table, each row being an address. If a row is checked, a marker should be displayed on a google map underneath. Any suggestion? ...

ajax code to change image on webpage in template

i have one website which is working on templates. in the template there is one main image & i want to replace that main image on some pages only not on full website. what i am looking for is to change the main image to new image on page where i need with ajax. when i see the css of that template i found following code to show image ...

Never store intermediate program state in DOM?

I managed to run into this funny bug the other day where too quick modifications of the DOM caused the entire internet explorer to crash. So i was thinking, why am i even setting these values if i'm going to change them later anyway? (the modifications are very unpredictable so completely avoiding the scenario is impossible) Some backg...

JavaScript's equivalent to PHP's __get() magic method

Possible Duplicate: JavaScript getter for all properties Does JavaScript provide a method to access undefined object properties? In PHP the solution is to declare and implement __get() method in class. Solutions using try { .. } catch { .. } are not sufficient for me, because I already have very large amount of code which actu...

Recalculate center math question

Want to recalculate x and y in a centered layout relative to the current viewers resolution. I have two numbers a set of coordinates x and y. x=140 y=80 x and y was recorded in a resolution sessionWidth, sessionHeight sessionWidth = 1024 sessionHeight = 400 Want to recalculate x and y so that they are relative to the viewers resol...

Fast factorial function in JavaScript

Looking for a really fast implementation of factorial function in JavaScript. Any suggests? ...

simple jQuery appears fine except in IE7

I have created a simple animation using jQuery and the mouseenter / mouseleave. It works fine in IE7, FF, Opera, Chrome and safari. however, something is wrong in IE7 - nothing happens at all - I can't even get alert boxes to pop up. Could somebody please take a look at my code and tell me what I am doing wrong before I pull my hair o...

Send parameters to a php file in different language

Hi all, I am querying a php script using js with following func call: $.post("http://localhost/abc/create.php",{ name:data } ,function(data){ alert(data); }); Now this name parameter can be in any language, eg: english, hindi etc.. my code is working fine for english. But it is not working for hindi. When i am...

Unpack BinaryString sent from JavaScript FileReader API to Python

I'm trying to unpack a binary string sent via Javascript's FileReader readAsBinaryString method in my python app. It seems I could use the struct module for this. I'm unsure what to provide as as the format for the unpack exactly. Can someone confirm this is the right approach, and if so, what format I should specify? According to th...

Inheritance in javascript, variables in the "parent"

I am doing OO javascript for the first time. I have read about inheritance and prototype and thought I had cracked it. Until I discovered this little example. function TestObject(data) { this.test_array = []; this.clone_array = []; this.dosomestuff = function() { for(var i=0; i<this.test_array.length; i++) ...

Using jQuery to process a JSON object

My JSON object is constructed like this: var Source = { Object: [ //Array {Title: 'Test', Type: 'Pet', Category: 'Cat', Description: 'Fluffy', Count: 2 } ] }; I was able to figure out how to properly add to the 'Object' array, but I can't seem to figure out the jQuery syntax to query the object based on the property li...

How to pass an array of string in a url

Hello i have an url in my jsp and i want to pass an array of string in this url to recover in my ActionForm ...

Adding Google Calendar API to a Chrome Extensions

Steps to reproduce issue: 1. Create a Chrome extension using content_scripts. 2. Add the Google JS api to your background.html file in order to use the Calendar API. 3. Try running google.load("gdata", "1"); I'm trying to use the Calendar API in my Chrome extension. I'm using content_scripts to run my js file when the page initially loa...

Create custom controls dynamically in ASP.NET

I want to create custom control (let's name it DesignPanel) that will allow user to design his own webpage structure that would be stored in a sitemap file. This Design Panel will have child controls inside ( SiteElement). User will build page strcture by connect Site Elements, customize them ( like change name) and add new ones. This l...

How to execute a javascript before dom is ready?

I need to execute a javascript before the page is start to load? how can i do it? Atfirst my script should execute, after completion of script, if i need i should load the page else i shouln't load it. For example if my script redirect to another page i shouldnot load the current page else i should load it. ...