javascript

google maps and ASP

I am very new to ASP and I have some small project to do, so I some help. I need to write asp page that will read latitudes and longitudes from database and place markers on the map. This is my current code function initialize() { // initialize the map var latlng = new google.maps.LatLng(-25.363882,131.044922); var myOp...

Looking for html string jquery parser ( parse <a> links and <img>images)

Hi, I am Looking for html string jquery parser ( parse <a> links and <img> images) or for code that will parse all links and images from html string (Html string can be very big). Example: input: sdsds<div>sdd<a href='http://google.com/image1.gif'image1&lt;/a&gt; sd</div> sdsdsdssssssssssssssssssssssssssssssssssss <p> sdsdsdsds <...

How to get the time of a given city?

I know that I can display time for a particular location using only JavaScript (and no web service or external data source), but... I want to avoid using this solution because I don't want to have to account for daylight savings time, and any other factors that make it complicated. I'm looking for an easier way to display the time and a...

What is the proper way to get bounding box for HTML elements relative to the Window?

I'm writing a Firefox extension. I'm trying to limit it to just XUL+Javascript (no XPCOM). When I get a mouseover event for an HTML element, I need to get its bounding box in the windows coordinate system (that is the built-in XUL document browser.xul). The obvious place to start is to put something like this in the mouseover event ...

js backspace and counting how many digits

i have this code for counting how many digits where entered var tnnod=0; function telephone(e) { if (tnnod<10) { var key; var keychar; if (window.event) { key = window.event.keyCode; } else if (e) { key = e.which; } else { return true; ...

Tumblr-like footer.

When you have endless scrolling enabled on Tumblr, when you put your mouse at the bottom of your dashboard, the footer fades in. How can I use that technique for my site? ...

How to cause a form to be submitted automatically on page load in JavaScript?

This may have an obvious answer, but I am very new to js so I have no idea how to do this. I would like a form on a page to be submitted automatically when that page is loaded without requiring any user action like pressing a button. How to do this? ...

Limit inserting the element to the page

I'm trying to limit inserting elements to the page: <script type="text/javascript"> $(function() { var i = 1; //allow only 3 elements if (i < 4) { $('#add').click(function() { var add_input = '<input type="file" />' var add_link = '<a href="#" class="remove">Remove</a>' ...

Why in ajax jquery function - should be writen function success:function (){myfun();} and not directly success:myfun() ?

Hi, I beginer in javascript and jquery soo my question about understanding of javascript syntax. Why in ajax jquery function - should be writen function success:function (){myfun();} and not directly success:myfun() ? Working: $.ajax({ type: 'POST', url: 'http://www.myurl.com', data: data, success: fu...

Javascript closures - variable scope question

I'm reading the Mozilla developer's site on closures, and I noticed in their example for common mistakes, they had this code: <p id="help">Helpful notes will appear here</p> <p>E-mail: <input type="text" id="email" name="email"></p> <p>Name: <input type="text" id="name" name="name"></p> <p>Age: <input type="text" id="age" name="ag...

Positioning cursor after inserted word

I want to position a cursor after an inserted word (test), in textarea. The insertion of the word can be in any position in textarea. (Internet Explorer) This is my script: document.activeElement.focus(); document.selection.createRange().text = "test"; var sel = document.selection.createRange(); sel.moveStart('character', -documen...

JavaScript window.status

hi this is my first attempt at JavaScript: the following function is used to display window status bar messages. it works fine on the local machine but when i upload it too the server the messages are not displayed at all. what am i doing wrong? please help. [website][link removed] function displayMsg(msg){ window.status = msg; } ...

Adding Input control to the pages with jQuery has problem with HttpFileCollection in ASP.NET

I'm trying to add upload controls to the page. This HTML mark-up with JavaScript is working fine but there s no option to remove the added control: 1. Example A <%@ Page Language="VB" AutoEventWireup="false" CodeFile="Default.aspx.vb" Inherits="_Default" %> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w...

HTML 5 Audio Looping

I've been playing with HTML5 audio recently, and though I can get it to play the sound it only ever will play once. No matter what I try (setting the properties, event handlers, etc) I can't seem to get it to loop. Here's the basic code I'm using: //myAudio is declared at a global scope, so it doesn't get garbage collected. myAudio = n...

Submit form with anchor + javascript - bad practice?

Dear Knowledge Base, I currently have two anchor tags sending url queries to put votes inside a database, but i want to switch to using forms to keep the urls clean and avoid duplicate queries (not really an issue, but makes it look ugly). Now the anchors need to contain a span-tag inside to add additional background elements to the b...

jQuery modal and load problem

I'm having a problem with jQuery dialog and load on a web application i'm developing. On a search result page, on each entry i have a link that give a quick view of the result, firing a modal dialog that retrieves and show html content using jQuery load. Everything works great and i can close and open dialogs as i want without any proble...

JQUERY, Adding an Event Listener to Items in an iFrame?

Given an iFrame with throughout the iframe... Is it possible to add an event listener with jquery to trigger an ALERT anytime the user moves their mouse over .fineme in the iframe, from the top/parent window? ...

empty Javascript function? What does it mean?

So the short version, what I don't understand is this line of code: (new Function("paper", "window", "document", cd.value)).call(paper, paper); The long version, look at these functions: window.onload = function () { var paper = Raphael("canvas", 640, 480); var btn = document.getElementById("run"); ...

How to get updated innerHTML with javascript

Hi I have this page contains 3 draggable divs. I'm using JQuery to drag these divs on the page. Now when I drag them to different positions. their attributes values should be changed to the new positions. for example when the page loads the first div value: <div style='position:absolute;left:1px;top:1px;'> after I drag the box ...

Best way to define a function ?

I'm always learned to define a function in JavaScript like this: function myFunction(arg1, arg2) { ... } However, I was just reading Google's guide to Javascript, it mentioned I should define methods like this: Foo.prototype.bar = function() { ... }; Question: Is "Foo" in the example an Object, or is it a namespace? Why isn't the...