javascript

asynchronous tweet button, image flickers

Hello, I am using the tweet button, with this asynchronous Javascript loading code below. When I place it at the bottom of my HTML the background image of the tweet button flickers, because it is loaded last. I noticed in firebug it is pulling this via an iframe and the image is a background specified in CSS. Is there anyway to load t...

Where to put all that jQuery JavaScript code?

From the documentation I've found this example: We can animate any element, such as a simple image: <div id="clickme"> Click here </div> <img id="book" src="book.png" alt="" width="100" height="123" /> With the element initially shown, we can hide it slowly: $('#clickme').click(function() { $('#book').fadeOut('slow', func...

jsp load arraylist elements from server side and pass them to javascript to print google maps markers

Hi in a jsp file i am loading from disk an arraylist which holds coordinates of places. How can i create from this arraylist's elements (server side) markers in a google map (client side). Thus, the question is how can i put the arraylist elements(coordinates) from the object that i load from disk (from previous app) into a javascript ...

Manipulating strings in jQuery

Hi folks I've got an anchor tag with a specific URL to which I want to add a class. I'm currently doing this as follows: $('a[href=http://this.ismyurl.com/folder/file.html]').addClass('red'); The problem I have is that this URL is not consistent. The filename, file.html is always the same, so if I could manipulate this string and f...

Can setTimeout ever return 0 as the id?

I am writing a check to see if a timeout is active. I was thinking of doing this: var a = setTimeout(fn, 10); // ... Other code ... where clearTimeout(a) can be called and set to null if (a != null) { // do soemthing } I was wondering if it would ever be possible that a will be 0. In that case I would use a !== null ...

Childwindow javascript method opening another child window

I am opening a child window using window.showModalDialog(). In child window I am calling another javascript method OK button click. When I do "OK Button" click in child window, another new child window is opening un-wantedly. Please follow my steps Here is the Parent Javascript method with window.showModalDialog() 2.In ProfilePic.aspx...

How to make those dynamic anchor links with jQuery?

I've recently discovered a website which does something really cool! Example: There are two links "Cat" and "Dog". There are two DIV containers, id="catImage" and id="dogImage" The initial URL looks like http://mysite.com/#cat Initially, the cat image is visible Clicking on the Dog link will fade out the catImage div and fade in the d...

javascript - get custom attribute based on an id

How can I find the seq number given the id in this example? <table> <tr class="row_header thin_border"> </tr><tr id="id33192010101533333" seq="2"> <td>20101015</td> <td>600</td> <td>730</td> <td><a href="#" onclick="deleteActivity(3319,20101015,1);">Click</a></td> <td><a href="#" onclick='selectEditActi...

How to communicate to a client side application with silverlight.

I'm currently developing a silverlight application with prism. From this application I need to be able to send a command or keystrokes to a client-side application. What is the best way to accomplish this? Things I'm considering: Javascript can use an ActiveX object to use DDE. (Limits to IE only) Javascript can interact with a java a...

Java Timer use on an ASP.NET 2.0 page with Master File

I have found out that sometimes the simplest things you want to do are almost impossible to fund an answer for. I have an ASPX page in ASP.NET V2 programmed in Visual Studio 2005. The ASPX page has a behind code ASXP.VB page and is tied to a .master file. I have two buttons [Button_Process] that will eventually call a program that will e...

JavaScript object comparison

Why do the last == and === operators return true here? var object1 = {value: 10}; var object2 = object1; alert(object1 == object2); // result makes sense object2.otherValue = 15; alert(object1 == object2); // doesn't make intuitive sense to me alert(object1 === object2); // neither does this ...

How do I shuffle the characters in a string in JavaScript?

In particular, I want to make sure to avoid the mistake made in Microsoft's Browser Choice shuffle code. That is, I want to make sure that each letter has an equal probability of ending up in each possible position. e.g. Given "ABCDEFG", return something like "GEFBDCA". ...

javascript - using a variable in getElementById

How can I use a variable in getElementById html: <td><a href="#" onclick='selectEditActivity("id3319201010153333");'>Click</a></td> javascript: function selectEditActivity(pass_id){ // this works alert(pass_id) // this works; var A = document.getElementById("id33192010101533333").getAttribute("seq"); alert(A); // b...

jQuery : drag and drop : find the id of the target

Hello friends I am developing a drag and drop app. I have a DIV that is draggable along the document and there are some other divs in the document, I can drag one div to other divs, but how can I find the id of the div to which I dropped the dragging DIV, I just want to know the id of the target DIV after placing another DIV over it. ...

writing JSON with JSP

You would probably do this automatically with some library. But I am new with Java and JSON and I need a quick sollution. What I would like is to write down (echo) JSON out of a JSP file. So far so good, but now I have a list of objects. So I start a fast enumeration. And now the question: how do I close the JSON array with }] instead...

back and forward buttons to control ajax loads

hallo together, i am searching for a solution, where the back and forward buttons control my ajax-call history. so if i maka a ajax call, and then press "back" i want to reload the original page. if i do a ajax call and then another, and then press the back button i want to do the first ajax call again. and so on ... (i.e. if i now w...

Remove Pan control in Google Maps API V3

Is there any way to remove the circular panning navigation control but keep the zoom control in the Google Maps V3 API? I've tried forcing it offscreen with jQuery but every time the map is updated it comes back. Any ideas? Thanks! ...

Dynamic Namespace in JavaScript

Is it possible to create a dynamic namespace in a javascript class? I'm running into an issue where I need to use this class twice on the same page but it uses the same namespace in both spots so it's failing. ...

Detect left mouse button press

I hate this mess with the mouse buttons created by W3C an MS! I want to know if the left mouse button is pressed when I get a mousedown event. I use this code // Return true if evt carries left mouse button press function detectLeftButton(evt) { // W3C if (window.event == null) { return (evt.button == 0) } // IE else { ...

Is JavaScript function a "function" or an "object" or both?

I am trying to get my head around how Javascript function behaves. Is it a function or an object or both? ...