javascript

JavaScript problem with Google Maps

Hi, I have tried to create an application which creates a marker on the map on user's click. Then if user clicks a marker an address should be displayed. Trying to accomplish this I encountered a problem and so far haven't found a solution. When I click on the map for the first time the first marker is created. Then when I try to click...

How to make this if statement shorter?

Can I make this statement shorter? if(abc=='value1' || abc=='value2' || abc=='value3') {//do something} to make it look similar to this: if(abc=='value1' || 'value2' || 'value3'){//do something} Thanks. ...

Javascript question--what is "window"?

<html> <script language="javascript"> /* This function is invoked by the activity */ function wave() { alert("1"); document.getElementById("droid").src="android_waving.png"; alert("2"); } </script> <body> <!-- Calls into the javascript interface for the activ...

[ruby] how to open hyperlink page from a client side.

this is what I want to do. a href="javascript:sayHello('an nyung')"> click here /a this code is in a server side. and I wanna to call this link from a client side by using ruby. is there any way to do this? ...

jeditable expand submitdata

The following example is given on the jeditable site: $(".editable").editable("http://www.example.com/save.php";, { submitdata : function(value, settings) { return {foo: "bar"}; } }); I'd like to know how to format in order to return multiple hashes. Something like the following: $(".editable").editable("http://www.examp...

Remove duplicates from an array of objects in javascript

I have an object that contains an array of objects. things = new Object(); things.thing = new Array(); things.thing.push({place:"here",name:"stuff"}); things.thing.push({place:"there",name:"morestuff"}); things.thing.push({place:"there",name:"morestuff"}); I'm wondering what is the best method to remove duplicate objects from an arr...

In Android Webview, am I able to modify a webpage's DOM?

Suppose I load a 3rd party URL through webview. public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.main); webview = (WebView) findViewById(R.id.webview); webview.setWebViewClient(new HelloWebViewClient()); webview.getSettings().setJavaScri...

jquery function doesn't return values correctly

I have this function $.fn.validate.checkValidationName = function(id) { $.post("PHP/submitButtonName.php", {checkValidation: id}, function(data) { if(data.returnValue === true) { name = true; } else { name = false; } **console.log("name = "+name); **//this prints out "true"**** }, "json"); }; and this...

How do you handle multi-argument JavaScript functions?

I have defined my JavaScript function as follows: function printCompanyName(company1, company2, company3, company4, company5) { document.write("<p>" + company1 + "</p>"); document.write("<p>" + company2 + "</p>"); document.write("<p>" + company3 + "</p>"); document.write("<p>" + company4 + "</p>"); document.write("<p>" + company5 + "</p...

IE7-js: reapply fixes after DOM changes

I've been using IE7-js for a while and now I need to re-apply the IE fixes after DOM changes (eg. new elements added). How should I do so? I tried with the ie7-recalc.js script, but witouth success. ...

How do I use regular javascript to look through every <a> tag and change the href?

A page has many tags. How do I loop through all of them and replace their "href" with "http://example.com"? (do not use jQuery) ...

Javascript MouseOver / MouseOut children events

I have an element with some child elements. When the mouse leaves the parent element I want to hide the parent and it's children. Problem I'm having is that when I hover over any of the children, the mouseout event is being fired. What's the best way to prevent this? I really only want the event to fire when the mouse is not within the p...

Positioning the div relative to mouse position

All, How to Position the following div relative to mouse position so that the mouse and div are not out ofsync at theend of the page.May be just like a tooltip which always sjows the perfect position at the end of the page.. <style type="text/css"> #div1 { width: 200px; height: 30px; background-color: #a9a9a9; color: #fff; position: ab...

APE-Project and ASP.NET MVC

Hi Guys, I am attempting to utilize the reverse-ajax project APE-Project with ASP.NET MVC and wondering if anyone has had any experience utilizing this project with ASP.NET and can provide some advice accordingly ? Is there something better to use than this [APE is free however so its +++] Thx ...

How many bytes in a JavaScript string?

I have a javascript string which is about 500K when being sent from the server in UTF-8. How can I tell its size in JavaScript? I know that JavaScript uses UCS-2, so does that mean 2 bytes per character. However, does it depend on the JavaScript implementation? Or on the page encoding or maybe content-type? ...

Problem with my JavaScript AJAX request in IE8

I have a products range on this site http://vanquish.websitewelcome.com/~hawko/hawko-lighting/led/ using jQuery In Firefox / Safari, clicking view will allow you to see more details on the product on the right. This includes a gallery (if > 1 images), a download specs sheet if one is available and view more details. The JavaScript wor...

A tricky javascript thing I'm wanting to do...pulling elements from a list and hiding the rest

As usual, I want to do more than I know how to do yet :-D Here's what I'm working on...I'm writing up a Bio. But within the bio, I want a "long bio" and a "short bio" button. The long bio will obviously display the whole bio, but the short bio would grab elements in the list and make them bold and contract the div to now only contai...

Prevent ability to add "instance variables" dynamically Javascript OOP

Hey all, I was wondering if there is a way to disallow the following in javascript: var c = new Circle(4); c.garbage = "Oh nooo!"; // Prevent this!! Any ideas? EDIT: I was just about to give up on this, but I decided to check to see what the gods do (jQuery dev team).. how do they accomplish this? $('#Jimbo').hello = "hi!"; alert($...

Using array element in child window to change image in parent window with getElementById

So I'm trying to complete some javascript and having trouble codeing links to update a image. In a parent window using my script I open a remote child window to operate the image. THe links on the child window open the first image and last image. Two more links control the "next" image and previous image. Heres what I have so far HTML...

Looking for Following JavaScript Library That Provide Navigation Menu Similar to FogBugz HomePage

Hello, I was looking for JavaScript library, which is able to provide navigation menu similar to http://www.fogcreek.com/FogBugz/learnmore.html (left most navigation menu) Any recommandation? Thanks. ...