javascript

create and modify xml file using javascript (want to save xml file on client side)

Hi , How to save xml file on client side using javascript...? if (window.XMLHttpRequest) { xhttp = new XMLHttpRequest(); } else // Internet Explorer 5/6 { xhttp = new ActiveXObject("Microsoft.XMLHTTP"); } xhttp.open("GET", "User.xml", false); xhttp.send("")...

JSF CommandLink does not work on Firefox after a whole form reRender

Hi all, I have a JSF 1.2 application (Sun RI, Facelets, Richfaces) that was used only on IE6 browsers. Now, we must also support Firefox (yeah !). In one of my pages, I have a form that contains a button that will re-render the whole form. After the re-rendering, some links (<h:commandLink/>) are added in this form. The JSF code looks...

How to close dialog opened by showModalDialog?

I tried this but failed: var win = showModalDialog('http://localhost/index.php'); win.close(); ...

Django reverse() for JavaScript

In my project I have a lot of Ajax methods, with external client-side scripts (I don't want to include JavaScript into templates!) and changing URLs is kind of pain for me because I need to change URLs in my Ajax calls manually. Is there is some way to emulate the behavior of {% url %} templatetag in JavaScript? For example, print ur...

Triggering onclick event using middle click

I am using the onclick event of a hashed link to open a div as a pop up. But the middle click does not trigger the onclick event but only takes the href attribute value of the link and loads the url in a new page. How can I use middle click to open the div as a pop up. ...

Possible/howto resize iframe on mouse focus?

I have two iframes next to each other at 50% width and am wondering if it's possible to resize one iframe to 80% when that iframe is moused over. Is it possible? If so, can someone post a small how-to on getting this to work? ...

button vs input type="submit" vs a onclick="document.formname.submit()"

Hi guys, Just trying to implement these buttons at the moment: http://particletree.com/features/rediscovering-the-button-element/ Can't decide which to go for, since here we mostly use IE6. As far as I can tell... button: Lets you submit the form as usual (ie hitting enter on the form), lets you disable it, standards compliant, does...

How to close a window without confirm dialog?

window.close(); The above will pop up a confirm dialog each time,and not working at all in firefox. ...

Javascript Checking array for presence of a specific number

Hi all, I have search through quite a lot of questions here, but havent found one that i think fits my bill, so if you know of one please link to it. I have an array that i want to search through for a specific number and if that number is in the array, i then want to take an action and if not then another action. I have something lik...

How can I insert a new Event for non primary Calendar using gdata.js ?

I am using gdata.js for inserting new Event. I am able to insert only user's primary calendar. The primary Calendar Feed uri is http://www.google.com/calendar/feeds/default/private/full Which feed uri can I use for insert a new event other than primary calendar. Thanks in advance. ...

How to get list of online friends using FQL with facebook API ?

I have got my friends list after getting logging in on facebook using Facebook connect Java script client API. I want list of my friends that are online at given time. ...

IE8 - Form within a hidden div, return key no longer works.

I have a login form that resides within a div with display: none; I then fade in the form using jquery but the Enter/Return key no longer submits the form. If I change the display to block, it works fine. This problem is IE only. Any ideas? Here's an example code that doesn't work; <div id='formdiv' style='display: none;'> <form id='l...

Web Service works in IE7 but not Firefox

Hi All I have a .Net web service that I call from javascript using: $.ajax({ type: "POST", url: "http://myServerIP/Myervice.asmx/MyMethod", data: "{}", contentType: "application/json; charset=utf-8", dataType: "jsonp", success: function(msg) { alert('sucess ' + msg); }...

Is it possible to send a value of a variable from a js file to a php file

Hi, I have script and I'd like to know if it's possible the send the value of a variable to $_session, <script> $(function() { var delivery = 0; $('#jcart-paypal-checkout').click(function() { delivery = $('form#delivery2 input[type=radio]:checked').val(); if(!delivery) { alert('Please choose a delivery option...

Can I wrap a javascript event in a jQuery event?

I have this code: <html> <head> <script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.3.2/jquery.min.js"&gt;&lt;/script&gt; <script type="text/javascript"> $(function(){ $('a.one').click(function(event){ event.preventDefault(); }); }); function test(event){ even...

properly bind javascript events

Hello. I am looking for the most proper and efficient way to bind javascript events; particularly the onload event (I would like the event to occur after both the page AND all elements such as images are loaded). I know there are simple ways to do this in Jquery but I would like the more efficient raw javascript method. Thank you ;) ...

Problem updating sortables in jquery

I have a page where i have a sortable list of items (a div with class 'sortable'), which can initially have some items in it or be empty. The items are in another list on the page, and have an 'add' button. When add is clicked, they go into the sortable list. When the page loads with some items in the list already, the sorting works...

Calculating difference between username and email in javascript

Hi, for security reasons i want the users on my website not to be able to register a username that resembles their email adress. Someone with email adress [email protected] cant register as user or us.er, etc For example i want this not to be possible: tester -> [email protected] (wrong) tes.ter -> [email protected] (wrong) etc. But...

Jquery Fadeout fadein with li elements problem

Hi, i have the following unordered list: <ul id="#lastcompanieslist"> <li style="display: none;" page="0">whatever 1</li> <li style="display: none;" page="0">whatever 2</li> <li style="display: none;" page="0">whatever 2</li> <li style="display: none;" page="0">whatever 3</li> <li style="display: none;" page="0">whatever 4</li> <li st...

Javascript Regex Match the first the occurrence

Hi, I've this regex (which doesn't do what i want): /^.*\/(eu|es)(?:\/)?([^#]*).*/ which actually is the js version of: /^.*/(eu|es)(?:/)?([^#]*).*/ Well, it doesn't do what i want, of course it works. :) Given this URLs: http://localhost/es -> [1] = es, [2] = '' http://localhost/eu/bla/bla#wop -> [1] = eu, [2] = 'bla/bla' http://loc...