javascript

Marker on Google Map added only once.

I have the following code: function clicked(overlay, latlng) { var icon3 = new GIcon(); icon3.image = "marker.png"; icon3.iconAnchor = new GPoint(15, 40); var marker2 = new GMarker(latlng, { icon: icon3, draggable: true, title: 'Drag me' }); map.addOverlay(marker2); } Each time I click on the map a new marker is pla...

I'm trying to display records from a database and then when a new one is added automatically update the displayed records from the database with the new one

I'm trying to display records from a database and then when a new one is added automatically update the displayed records from the database with the new one I am doing this using php and javascript. I want to load a page and display tags under a video and then when a user adds a new tag by entering it into text box to add it to the data...

Pocket IE onmousedown onmousemove onmouseup ?

Hello all, I have a control which I wrote for capturing signatures on a web page, by using onmousedown, onmousemove and onmouseup on a div to track the mouse, and capture points comprising a signature. Now we need this to work on Windows Mobile 6.5 powered devices... but it seems that the div element does not support the mouse events i...

What does the MS Ajax Framework use location.hash for?

I've noticed that the MS ajax framework touches the action of the default form during Sys.Application.initialize, appending location.hash to it. This is interfering with other code in my app that expects different behaviour. What does the framework do with that? It refers to the values it puts on the hash as 'state', but how do I find ...

Display image at point using jQuery

I have an image with a click event handler that captures the location where you clicked. $("#image").click(function(e) { var x = e.pageX - $(this).offset().left; var y = e.pageY - $(this).offset().top; }); I want it so that when the image is clicked an image appears at that location on top of the image. How do I do this? ...

[Google Visualization API] Format Y axis tick mark numbers

Hello, I am using the annotated timeline visualization and I am wondering if it is possible to format the numbers that are on the side of the Y axis ( on the Y-axis 'tick marks'). What I need explicitly is a way for these numbers to be truncated to whole integers, and not display the decimal parts, so they do not take as much space. I...

Global variable life in Javascript - destroyed on a reload?

(I am learning Javascript) Problem: A page I am working on has 2 views, a data entry view with a textbox and a data rendering view. There is a a href src="currentpage#" link that switches between the 2 views. In order to transmit data from view to view, the javascript parses it from the current HTML and pushes it into the correct form f...

Change Iframe Content from Cached HTML?

Is there any way that I can change the content of iframe from a cached html string? I am not talking about iframe.Attribute["src"] = "url", but rather given a string of html and change the content. An ugly workaround might be saving the html into a file and change iframe src to it. Any other ways? Maybe javascript can help? ...

How can I add a JavaScript keyboard shortcut to an existing JavaScript Function?

Here is my code: function pauseSound() { var pauseSound=document.getElementById("backgroundMusic"); pauseSound.pause(); } I would like to add a keyboard shortcut to this code, how can I do this so that the function can also be executed when a button is clicked too? Tried to add an else-if statment but it doesn't work, any id...

how to strip namespaces with e4x?

I have an arbitrary XML document provided by a URL. I also have an xpath-like expressions. var xml = <doc><node1><node2><node3>some value</node3></node2></node1></doc>; var path = "node1.node2.node3"; I need to verify if the above path into the XML is valid. I tried to do this using eval and E4X. var value = eval("xml."+path); Ho...

Mapping multiple keys to the same value in a Javascript hash

I use a Javascript hash object to store a set of numerical counters, set up like this [this is greatly simplified]: var myHash = { A: 0, B: 0, C: 0 }; Is there a way to make other keys, ones not explicitly in myHash, map to keys that are? For instance, I'd like [again, this is simplified]: myHash['A_prime']++; // or myHas...

Visual Studio Warning "Content is not allowed" in ASP.NET project

Hi, I am just started working as a programmer last month, so there will be plenty of newbie question come from me, stay tuned... I am now working on modify the provided template (from DevExpress) to create new web form using ASP.NET 2.0 on Visual Studio 2008. While the functionality of that web form is there, I am in the process of get ...

What is the best way to limit text input entry to numbers, lowercase letters, and certain symbols?

Without using jQuery, what is the best way to limit text entry of a textbox to numbers, lowercase letters and a given set of symbols (for example - and _)? If the user enters an uppercase letter, I would like it to be automatically converted to a lowercase letter, and if the user enters a symbol not within the given set, I would like to ...

How to set caret position at the start of designmode wysiwyg in Firefox

I have seen (and use) the answers relating to getting / setting the CURRENT caret position in an iframe with designmode=on. However I need to be able to set the caret position to either the start or the end of the content. IE solution not required, just WC3. Thanks in advance. ...

capture browser restore option

Hi! How I can capture browser restore/maximize event in jQuery or javascript? We can use window.onresize but that only tells that the browser is resized. thanks! ...

How can I improve this regular expression?

I want a regular expression to match valid input into a Tags input field with the following properties: 1-5 tags Each tag is 1-30 characters long Valid tag characters are [a-zA-Z0-9-] input and tags can be separated by any amount of whitespace For example: Valid: tag1 tag2 tag3-with-dashes tag4-with-more-dashes tAaG5-with-MIXED-c...

Execute function every nth second

Total JavaScript n00b question right here: I've made this snippet that clicks a link after 10th second: function timeout() { window.setTimeout(function() { $('img.left').click(); }, 1000); setTimeout("timeout()", 1000); } timeout(); My question is, how do I execute this function every 10th second, instead of just on...

How do I check if the browser supports cookies, in javascript?

Especially for the iPhone ...

How do i sort by: most viewed, most commented, most popular, best rating, etc?

Pretty basic question.. I kno.., I just don't know how its done. I see it everywhere. I want to be able to sort out my content in my websites by most viewed, most commented, most popular, best rating, etc...with a drop down list, check box, etc... but I don't know how "sort by" works? Which scripting language should it be written in? Ja...

Keeping a set of environment variables in rails and javascript

essentially, we want to keep a set of constants to be used across the rails app and javascript code. For example: {A:3 B:4 C:5} We try not to embed rails code in javascript, and we do not want 2 copies of constants. Thanks! ...