javascript

How do I preserve variable values between HTML files?

Let's say I have a page that refers to a .js file. In that file I have the following code that sets the value of a variable: var foo; function bar() { foo = //some value generated by some type of user input } bar(); Now I'd like to be able to navigate to another page that refers to the same script, and have this variable...

Javascript error Permission denied for <http://www.mydomain.com> to call method Location.toString on <http://clientdomain.com>.

Hi, We have prepared a Javascript based embeddable application. It works well on all the websites. But one website publisher is facing trouble when embed our application, there is a javascript error which I have mentioned in the title. Permission denied for http://www.mydomain.com to call method Location.toString on http://cl...

How to print a dynamic message in a <div> tag using Javascript?

I have a message "I have 3 tries left", in this message "3" is dynamic and by default my <div> tag is set to style="display:none" : <div id="triesleft" style="display:none"></div> I am looking for a way to display the above message in a <div> dynamically on onchange event of a select box.. I tried with this function triesleftfunc()...

num++ in javascript

var num = "1"; num = num+1; //Gives "11" but var num = "1"; num++; //Gives 2. Why? ...

Error with passing json constructed data and receiving xmldocument as output

I have the following ajax call to webservice to pass json data and get response xml data, when i debug the code the flow is not reaching the webservice var keyword2 = "{\"keyword1\":\"" + keyword1 + "\",\"streetname\":\"" + address1 + "\",\"lat\":\"" + lat + "\",\"lng\":\"" + lng + "\",\"radius\":\"" + radius + "\"}"; ...

Rest / HTML - If server stops detect if server starts again?

Something I am playing with at the moment is a Rest / HTML page that dynamically updates via JSON calls. Now in the case that I want this to run on as low a bandwidth as possible. So if the server is shut down, then booted up again I want the updates to continue again in most cases this works some cases parts of the javascript won't wo...

How do I remove a selected date from a jQuery UI Datepicker?

Hi, After selecting a date on a jQuery UI Datepicker, how can this selection be programmatically removed? I'd like to remove/change the selected date, not the current date! Many thanks! ...

How to select all values in drop down list by clicking a button using jQuery?

How to select all values in drop down list by clicking a button using jQuery in JavaScript? Thanks in advance ...

On changing an image source to the source of another image with jquery.

Should the following code not work? $('.elastica').click(function(){ document.getElementById('bigimage').attr('src')= $(this).attr('src'); }); It doesn't change a thing on the site. I've also tried this outputting the image location trough the the other image's id, but it comes up empty (literally ""). When I output the other imag...

How is the new google logo (moving balls) implemented?

I got the code for the new google.com's doodle: http://gist.github.com/567948 The problem is, all the values in the <div id="hplogo"> is changing dynamically, but not when I copy the code in my local machine. It seems only JS + DIV, anything missing? But now able to replicate it on my local machine. Any suggestions? ...

Reading how function was executed

Hello there people! I'm currently working on a very poor developed system, and I have to make some bug fixes before this product is released in beta stage. The site is built with lots of javascript, and I'm not very familiar with it. The question is - is there a way to read how my function was executed? Like.. Function was called by o...

Is it possible to focus on a <div> using javascript focus() function?

Is it possible to focus on a <div> using javascript focus() function? I have a <div> tag <div id="tries">You have 3 tries left</div> I am trying to focus on the above <div> using : document.getElementById('tries').focus(); But it doesn't work. could someone suggest something....? ...

Communicating back to parent from a Webkit notification

I'm using webkitNotifications and createHTMLNotification, etc. to successfully create a notification in Chrome (Windows). Now I would really like to have the notification window communicate back (or at least set the focus to) the tab/window that created the notification (which is part of the spec). I realize it's still in the early pha...

Changing location within Modal Dialog

Hi, In a simple web app I'm opening a modal window which loads a jsp using window.showModalDialog. I have the following questions: I have a button in the JSP within the modal dialog. It has a click handler that says: document.location.href = 'http://www.google.com'. Problem is, when the button is clicked, the parent window's location ...

Function required and not-required variables

In PHP we can specify default value of variable in function like: function myFunction(myDefaultVariable, myOtherVariable, myCheckVariable = "basic"){ // so yeah, myDefaultVariable is required always, // same applies for myOtherVariable, // and myCheckVariable can be skipped in function call, because it has a default value al...

How to create a sitemap using jQuery

I have following markup <div id="mnuMain"> <ul> <li><a href="#">Dashboard</a></li> <li><a href="#">Market Trends</a></li> <li><a href="#">Master</a> <ul> <li><a href="#">Products</a></li> <li><a href="#">Segments</a></li> <li><a href="#" >Companies</...

Problem in diaplying mouse coordinates with the Mouse Pointer

i have written this code, i am facing the problem of attaching the mouse cordinates with the mouse pointer, i have import an external file of svg in html through an object tag, the problem is that when i mouseover on the svg element the coordinates are not being displayed on the svg element,with the mouse pointer i am using a span tag to...

How can I observe the existence of a file with ajax live?

I want to observe the existence of a file with ajax. At the moment I have a refresh button, I have to press to refresh the status. I want to automate this refresh. ...

change the cursor point as zoom in and zoom out symbol

hi i want to know how to change the cursor point to zoom in and zoom out symbol. i know how to change the cursot point as busy,wait and etc., document.manual_production.style.cursor='wait'; but i dont know, the cursont point for zoom in and zoom out. oh ok i got it by this way document.manual_production.image1.style.cursor='-moz-zoo...

dynamic href id tags with Jquery Tipsy plugin

I am trying to get the tipsy plugin working and can't seem to do it with dynamic id's. this is the code I was trying to use. jQuery(document).ready(function(){ jQuery("a#[id^='pro_']").each(function(){ jQuery("a#[id^='pro_']").tipsy({gravity: jQuery.fn.tipsy.autoNS,live: 'true'}); }); }); a link would look someting l...