javascript

Html page mini map or map overview

I have a big html page, like 4000x6000 px with images and text. I'd like to have something like a map overview of this page in a small div. A scaled version of the whole page which i could use to navigate. Does anyone know some js script or example how to do that? Thanks. ...

Jquery Change event for input and select elements

Hello all, I am trying to alert something when ever a drop down box changes and when ever something is typed into an input. I don't think I can use change for input fields? What would you use for input fields? Also, what about input fields of type file? Same thing. Here is what I have so far and its not working: $('input#wrapper, s...

How to evaluate json member using variable ?

Hi i've got a problem evaluating json. My goal is to insert json member value to a function variable, take a look at this function func_load_session(svar){ var id = ''; $.getJSON('data/session.php?load='+svar, function(json){ eval('id = json.'+svar); }); return id; } this code i load session from php file that i've store befor...

javascript regex validation

Is there any way to find which input character fails the regex pattern. For ex: consider [A-Za-z\s.&] is only allowable but the user enter like "test/string" where '/' invalidates input. How to find who fails regex (our case '/') ...

Call a code behind function from javascript in aspx

I have a page where a javascript will be triggered when the user closes the browser tabs / browser window. Language is in c# thanks. im using window.onbeforeunload, something along the line like this: <script type="text/javascript"> window.onbeforeunload = myFunction; function myFunction() { //call my function here } the ...

setTimout not stopping

Hi all, I'm building a quiz and user has 5 seconds to respond to the qeustion if he doesn't resond within the time the answer is 3(wich is a code for no answer). Timer updates just fine until you answer a qeustion from that point the timer runs out of control you see 5,3,4,0 and go to the next qeustion with the answer 3 does anyone know...

ff extension. how to pass parameters to a function in the oncommand attribute in menu

I have a ff extension which creates a popup and shows dynamic data in it. basically when the popup opens a js function is run which then constructs the popup list by appending the items like this var myMenuPopup = document.getElementById("file-popup4"); newItem = document.createElement("menuitem"); newItem.setAttribute("label", namelist...

help with click-to-copy-into-clipboard function and open new frame/page

Hi, Im currently building a new discount-webpage and Im looking for a solution to be able to hover over a discount button to reveal a small text without clicking. And after clicking on the button that the text in the flash button is copied into the clipboard and a new page open with a small frame from my window with the new page undern...

Using jquery append() in <head> (in a function/class)

I want to use the append() function from inside the <head>, in a function to be specific, like so: function custom_img(src_img) { $("div").append("<img src='"+src_img+"'>"); } var myimg = new custom_img("test.jpg"); This is a quick example that I just wrote out. I want my function to make a new image like that every time I create a n...

Jquery - intercept links clicked inside an iframe

Hi, I am trying to intercept links clicked on a page including those inside an iframe. This is the code that I have but it is not working. Any ideas what I need to do? $("#container").delegate('a', 'click', function(e){ //do stuff } Container is the id of the div just inside the iframe. Thanks in advance for any advice ...

What does addListener do in node.js?

I am trying to understand the purpose of addListener in node.js. Can someone explain please? Thanks! A simple example would be: var tcp = require('tcp'); var server = tcp.createServer(function (socket) { socket.setEncoding("utf8"); socket.addListener("connect", function () { socket.write("hello\r\n"); }); socket.addListener(...

Can't access variables from dynamically loaded javascript

I'm using a fairly simple system to load javascript dynamically: include = function (url) { var e = document.createElement("script"); e.src = url; e.type="text/javascript"; document.getElementsByTagName("head")[0].appendChild(e); }; Let's say I have a file test.js which has the following contents: var foo = 4; Now, in my or...

change background color with change in mouse position

I was wondering if it is possible to set background-color with help of mouse coordinates. What i have is: I have a DIV-A which is draggable and some other divs which are droppable. What i need is : I need to highlight other divs on my page which are droppable, whenever my DIV-A passes over them. What i have is mouse coordinates, is i...

How to turn character date into integer JavaScript

I need a way to turn my 2 character string dates (i.e. '04/10/2010' & '05/24/2010') into an integers to see if one is greater than the other. If the user enters an end date that is less than the begin date I need to popup an "invalid date range" error. ...

Mobile safari - suppress Unsupported Protocol alert

Hello guys, I'm creating a website for iPhone and i use the native app (cliqcliq Quickpick) to upload photos. I use the script like the following to check if the application is installed. The basic idea is to send user to a custom url, if application is there it is launched, if it is not there the url should be ignored and user is take...

Where should I put JavaScript files that need to be internationalized in a Django project?

Currently all JavaScript files are served from our static/media directory in the top level project directory. When running makemassages -d djangojs it will generate the locale directory in the top level too. However, javascript_catalog will only consider locale directories created in apps, i.e. listed in the INSTALLED_APPS setting. Wha...

javascript div positioning

I am using this script to display an image as popup on mouseover. The difficulty I am facing is that it is not positioning well in different monitor. It must be something to do with resolution. function LargeImage(obj, e) { var imgbtn=document.getElementById('<%=imgbtn1.ClientID%>'); imgbtn.src=obj;//source of the image document...

Collect DOM elements from external HTML documents

I am trying to write a report-generator to collect user-comments from a list of external HTML files. User-comments are wrapped in < span> elements. Can this be done using JavaScript? Here's my attempt: function generateCommentReport() { var files = document.querySelectorAll('td a'); //Files to scan are links in an HTML table v...

Images not loading online but works when I try it offline (local), why is this?

I am using localgetstorage and setstorage to load a list of links and show them as in a slideshow. The problem is that when I preview it on my PC it works, as soon as I try to use the page in my server online it won't work. Have I done something wrong? Here's a link: http://hem.bredband.net/noor/bildspelet/bildspelet.html It is very b...

Google Tasks-like js control

I need to imitate Google Tasks look and feel with a few minor changes. Is there an open-source JavaScript control that I may reuse? The main feature that I look for is "plain-text-like" feel of the in-place task editing process. ...