javascript

some general JavaScript questions

From the Flattr Javascript API description: <script type="text/javascript"> <!--//--><![CDATA[//><!-- (function() { var s = document.createElement('script'), t = document.getElementsByTagName('script')[0]; s.type = 'text/javascript'; s.async = true; s.src = 'http://api.flattr.com/js/0.5.0/load.js'; ...

Check the value of hidden field - Stay on page or Proceed to Next Page

I want to check the value of a hidden field triggered by a "h ref onClick" javascript function. If it is"empty", I want to prompt the user to rate my page using a ratings form (thereby staying on the same page and ignoring the h ref target page. If the value is "rated", I want to simply allow the user progress to their intended page. He...

jQuery datetime formatter

Is there a working jQuery plugin (or a javascript 'library') for formatting datetimes? I found some, but they were: not working with hours and minutes (the one from datapicker) not fully functional - can't give you names of months, leading zeroes, etc. are just a piece of code written in some blog. Of course I can implement it, but i...

show browser preferences & Page Setup using javascript

Is there a way to use javascript to activate the preferences dialog, so that a user can change a proxy address if they need to & also be able to click on an anchor link and have the Page Setup Dialog open, so that they can choose the page orientation for printing. The reason for this, is becuase I am trying to use mozilla Prism to deplo...

passing .php array into a javascript code jquery/ajax

At the moment i have this piece of javascript code: //Display custom confirm box and delete multiple message $(document).ready( function() { $(".delete_button-multiple").click( function() { //Get message id as variable var id = $(this).attr("id"); var dataString = 'id='+ id ; var parent = $(this).parent(); //Display custom Confi...

Getting Data Out of a XMLHttpRequest

Hello, This has been bothering me for ages and I tried everything and I cannot get it to work. Here is my function currently function example1() { var xmlhttp = new XMLHttpRequest(); xmlhttp.open("GET", url,true); xmlhttp.onreadystatechange=function() { if (xmlhttp.readyState==4) { data=(xmlhttp.responseText); ...

JavaScript: using Flattr API. how to wait until API is loaded?

Hi, I'm trying to use the Flattr JavaScript API. I included the loading code as described. But FlattrLoader.setup() does not work. I am getting the exception ReferenceError: FlattrLoader is not defined. I tried both <script type="text/javascript"> FlattrLoader.setup(); </script> and <script type="text/javascript"> window.onlo...

how to modify this javascript time function to show hours less than ten as: 0x.

//Live Javascript Server Time function getthedate(){ var mydate=new Date() var hours=mydate.getHours() var minutes=mydate.getMinutes() var seconds=mydate.getSeconds() var dn="AM" if (hours>=12) dn="PM" if (hours>12){ hours=hours-12 } if (hours==0) hours=12 ...

Node.js web sockets server: Is my idea for data management stable/scalable?

Hi, I'm developing a html5 browser multi-player RPG with node.js running in the backend with a web sockets plug-in for client data transfer. The problem i'm facing is accessing and updating user data, as you can imagine this process will be taking place many times a second even with few users connected. I've done some searching and fou...

Refire the jQuery ready event ?

I am using the jQuery $(document).ready() event on page. All is fine, except that if I am loading data using Ajax calls, the $(document).ready() event does not fire. I guess that it behave in such way because the page was already loaded and I am just adding more data from the Ajax response to the DOM. How can i refire the ready event ?...

jQuery form validation issue

I'm not using any jQuery plugin to validate the form, just plain jQuery. My issue is that after it validates all the input elements, even if it shows the error message to the user, it will still submit the form without the user correcting the error. To elaborate, my form has 3 input elements. with jQuery validation, if all the 3 elemen...

How to: Dynamically move google gauge?

Watch the CPU and Memory gauges for a second here: http://code.google.com/apis/visualization/documentation/gallery/gauge.html#Loading they move dynamically. My question - the example code shown below there does not move the gauges like that (or at least when I tried it in my own project.) Does anyone know how to get it moving dyna...

How can I send data to a user that will persist between web page views, but which won't be resent to the server?

I want to send some data to a user after they log in to a web site, some kind of secret string for encryption. I want to allow them to navigate around the web site, and I want to be able to use javascript on their machine to encrypt data before it's sent back to the server. Note: This will be in addition to using SSL. I don't want to u...

Preloading images before CC - per souders

I saw a PPT from steve souders about loading images before the css for a similar situation that i need.... but im not clear on what the actual code is to do this. I assume he loaded something before the css and in his ppt he says this new Image().src = "http://webcelerity.com/blog/wp-content/themes/carrington-blog-faster/images/sprite....

MVC2 Client-side validation for a DateTime?

What approach do you recommend for validating a DateTime on the client side in MVC? Let's say I have a model with a property named DateOfBirth that is a DateTime, like so. public class UserModel { [DataType(DataType.Date)] public DateTime DateOfBirth {get;set;} } On the View, I have a simple <%: Html.LabelFor(model=>model.D...

Graphic elements not assigned parent elements on Safari iPad when using Google Closure

I'm using Google closure to create a simple interactive graphic in HTML/JS to be viewed on iPad Safari. The code sample below shows expected behavior on Safari Mac and all other major browsers (a circle appears that when clicked generates a console message), but not Safari iPad. No event handler is registered with the circle. Instead, a...

How to: Dynamically invoke javascript from asp.net input box?

I have a asp.net input box: <asp:TextBox ID="InCL" runat="server" Text=""></asp:TextBox> As soon as a number is entered I would like to send that value to a javascript function that updates a google gauge. For example, user inputs 77, the google gauge immediately dynamically moves to that position. Any help is appreciated. Tha...

jQuery carousel transformation

How can I transform jQuery carousel to show 3x3 square of images instead of 1x3? From: <- |image| |image| |image| -> To: |image| |image| |image| <- |image| |image| |image| -> |image| |image| |image| My source code is like this: <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/x...

Silverlight HTML-JS-DOM Bridge : Real world use cases?

I've seen a lot of stuff online that shows proof of concept tutorials of how Silverlight can be used to enhance web pages by handing tasks off to it to make use of threading, manipulate the DOM, achieve Comet-like functionality etc. It all seems very interesting, however, has any one got any real world use cases to share as I can't seem...

Will removing the type from a <script> tag break in any browsers?

In HTML5, you no longer need to include the type in a script tag when you are using JavaScript. Are any common browsers (IE6+, Firefox 2+, Safari 3+, Opera 9+ or similar) going to break if the type is removed from all the <script> tags? So, is changing the following: <script type="text/javascript" src="/path/js.js"></script> <script t...