javascript

A good way to redirect with a POST request?

Hi folks, I need to redirect a user to an external site though a POST request. The only option I figured out is to do it submit a form through JavaScript. Any ideas? ...

html form.input.value is not getting printed why ?

... <script type="text/javascript"> function printvalues() { document.write("This is my first JavaScript!"); document.write(form.inputobj1.value); document.write(form.inputobj2.value); } </script> <form name="form"> <input name="inputobj1" value="123" /> <input name="inputobj2" value="abc"/> <input type="button" onclick =" pr...

javascript setTimeout() first argument: expression error

function Timer() { this.initialTime = 0; this.timeStart = null; this.getTotalTime = function() { timeEnd = new Date(); diff = timeEnd.getTime() - this.timeStart.getTime(); return diff+this.initialTime; }; this.formatTime = function() { interval = new Date(this.getTotalTime()); return interval.getHours() + ":" + inter...

Authenticating to get events from Google Calendar with a (local) Javascript

Is it possible to authenticate to google calendar (when you know the username/password) using its JavaScript API? I tried calendarService.setUserCredentials(username, password); but it didn't work ...

What's faster to parse lots of data (5Mb): eval or json?

I want to get, via ajax, a collection of data objects and parse them into JS data. Currently I have 2 choices: - Server returns valid javascript code and then I eval it. - Server returns JSON object and then I eval the json object What is the fastest of these in Firefox? (I only care about the "parsing" performance, not server or da...

javascript new Date(0) class shows 16 hours?

interval = new Date(0); return interval.getHours(); The above returns 16. I expect it to return 0. Any pointers? getMinutes() and getSeconds() return zero as expected. Thanks! I am trying to make a timer: function Timer(onUpdate) { this.initialTime = 0; this.timeStart = null; this.onUpdate = onUpdate this.getTot...

Can JavaScript load raw bytes to use in HTML 5 Canvas?

Say I had a file like... http://my.website.com/myfile.raw and this file was just raw bytes, representing an intensity image. Is it possible to grab this data and read the bytes in JavaScript? And then using it with HTML 5 canvas (e.g., putImageData) to draw an image? Or is there some other way to do this in the browser without Java or...

How to create an "endless" scrolling slideshow?

I know a good bit of JS and I'm familiar with jQuery, and I'm trying to create an "endless" slideshow (like the one on http://thisismedium.com/), where the images scroll -- one right behind the other -- and when it reaches the end it loops. I don't really know how to start, so I was hoping someone could point me in the right direction....

passing input text value to ajax call

Hi, I have to pass string entered in the input text to server method calling through jquery ajax. But its not going through. can please somebody tell me what i m doing wrong here. Below is the code: $.ajaxSetup({ cache: false timeout: 1000000}); function concatObject(obj) { strArray = []; //new Array for (prop in obj) { ...

jQuery Script works in all browsers but Chrome

This site has a script that works in all browsers I tested but Chrome, which I think is strange because it is usually IE that acts up. What should happen is that there is a dynamic tour through the store, in Chrome only the picture is seen, it seems like none of the script triggered. The error console says Uncaught TypeError: Cannot ca...

javascript: how to display script errors in a popup alert?

I want to display script errors in a popup alert instead of showing them in the browser console. window.onerror = function() { var message = /* get error messages and put them here */; alert(message); return true; }; ...

How do I transfer a javascript value to a php variable?

I have an html table containing values that are being generated from javascript. How do I transfer those values to php variables? ...

Javascript double event firing

I am returning a simple javascriptResult that unhides a div. When I do this, other click events that post ajax will now post twice when clicked. What could be causing this? ...

how do I get co-ordinates of selected text in an html using javascript document.getSelecttion()

I would like to position element above selected text. But I am not able to figure out the coordinates. var sel = document.getSelection(); if(sel != null) { positionDiv(); } Example: (image) ...

JQTOUCH, Binding to links pulled in via AJAX, to make another AJAX call? Possible?

Hello. I'm using JQTOUCH using the AJAX example provided in the demo: $('#customers').bind('pageAnimationEnd', function(e, info){ if (!$(this).data('loaded')) { // Make sure the data hasn't already been loaded (we'll set 'loaded' to true a couple lines further down) $('.loadingscreen').css({'display':'bl...

how can i write dynamic javascript

hi, how can i write dynamic javascript any simple example or any references. thanking you <html xmlns="http://www.w3.org/1999/xhtml" > <head runat="server"> <title>Untitled Page</title> </head> <body> <form id="form1" runat="server"> <div> <script type="text/javascript" src="swfobject.js"></script> <div id="flashPlaye...

javascript regular expression followed by open square bracket

text = text.replace(/\.(?=[a-zA-Z0-9\[])/g, "<span style='background-color: #FF00FF'>.</span>"); I want to use javascript to highlight all full stops that is followed by letters, numbers and [. The above expression works for letters and numbers, but not bracket. Any idea what's wrong? ...

What are pros and cons when choosing jquery as my primary javascript library?

I have started a new web application and have decided to use jquery as my primary javascript library... But still i want to get some pros and cons tips from SO users who used jquery ... ...

Focusing a textarea

Int he below code a textarea is added 6 times and initially the textarea conatins the text Enter Text. My question is, if the user enters data in first and third textareas. How to give alert to the user saying that the "textareas are empty" this is a general message but focus on the 2nd textarea and when the user enters data in 2nd the ...

Diff between document.getSelection() and window.getSelection()

Also can you please answer this question? http://stackoverflow.com/questions/2605133/how-do-i-get-co-ordinates-of-selected-text-in-an-html-using-javascript-document-g thanks ...