javascript

JavaScript Date Function

Hi, I'm using the following function that changes a calendar selection at a set time during the day (all code works perfectly). However, I'd like to modify it slightly so that on a SATURDAY the dd=dd+1 becomes dd=dd+2, because I want to skip Sunday. Can anyone help? $(function() { var dd = 0 if (<%= currentHour %> > <%= cutoffHou...

Is there another way of setting the array values in javascript

Hello. Again I'm still new to this javascript thing, so just would like to know if there is another way of setting the values of an array (just like declaring it); //correct way of declaring an array and reusing var adata = new Array('1','2','3'); //reusing of variable adata[0] = '4'; adata[1] = '5'; adata[2] = '6' This part is my que...

how can I know that onmousedown event is set for a link?

Hi guys, I want to parse an html document after it has loaded and discover all the links that the onmousedown event is set for them - how do I do that? Thanks Alex ...

Jquery submit form error

I have a form which I want to submit upon button click which is outside the form, here is my HTML : <form id="checkin" name="checkin" id="checkin" action="#" method="post"> <input type="text" tabindex="100" class="identifier" name="identifier" id="identifier"> <input type="submit" tabindex="101" value="Submito" class="elsubmito"...

how to override flowplayer onError message

I have the following js. If the flv url doesn't exist the onError function is called which is great. However currently it displays the alert and then proceeds to display an unfriendly error message. How can i override this message with something more user friendly. $f(videoid, "/swf/flowplayer-3.1.5.swf", { playlist: list1, ...

Javascript String Length Differs From PHP mb_strlen

I use document.getElementById("text").value.length to get the string length through javascript, and mb_strlen($_POST['text']) to get the string length by PHP and both differs very much. Carriage returns are converted in javascript before getting the string length, but I guess some characters are not being counted. For example, [b]15...

What am I missing in the XMLHttpRequest?

Hi guys, I'm completely new to the javascript and ajax world but trying to learn. Right now I'm testing the XMLHttpRequest and I can't make work even the simplest example. This is the code I'm trying to run <script type="text/javascript"> function test() { xhr = new XMLHttpRequest(); xhr.onreadystat...

appending SVG string to dom

I'm trying to append a string of svg elements to the dom. This is my setup. var oFragment = ''; for (var i = 0; i < 10; i++) { oFragment += '<g><path id="note-'+i+'" d="M 6,3 84,6 c 0,0 -6,76 14,91 L 58,97 19,89 c 0,0 -24,-5 -13,-86 z" style="fill:#ffc835;" /></g> '; } Here is what i tried. It gives the following error: "parseXML i...

get image size using javascript or jquery

Hello, I want to get the image size using javascript or jquery. something similar to imagesize(). Thanks Jean ...

Resizing image size using javascript

Hello, I am trying to resize the image using javascript, but I am getting errors var y; var y = new Image(); y.src = s; var wd = y.width/600; var ht = y.height/600; if(ht>wd){ var rw=round(wd * (1/ht)); var hw1 = ht * (1/ht); var hw=round(hw1); } else...

jQuery: Handle blurring of each field in a form

I've got a form and I need to post data to the server every time a field in the form is changed. How do I apply a function to each child element of the form on blur? ...

How to use outerHTML in JavaScript?

How to use outerHTML in JavaScript? Thanks ...

ANTLR, optional ';' in JavaScript

I'm just playing with ANTLR and decided to try parsing JavaScript with it. But I hit the wall in dealing with optional ';' in it, where statement end is marked by newline instead. Can it be done in some straightforward way? Just a simple grammar example that doesn't work grammar optional_newline; def : statements ; statements ...

jQuery - datepicker - onblur

I'm using the jQuery datepicker where I have two textboxes (start date / end date). The user clicks in a respective textbox and the calendar shows up. That is OK. What I need to do is when the user say, clicks in the start date textbox and picks a date. I need an onblur event to be triggered then. Where do I set that onblur event for ...

called function A(args) calls a function B() which then calls a function A(args), How to do that?

See example: <!DOCTYPE html> <html> <head> <title>language</title> <script type="text/javascript" src="http://www.google.com/jsapi"&gt; </script> </head> <body> <div id="language"></div> <script type="text/javascript"> var loaded = false; function load_api...

JavaScript autocomplete upon typing

Right guys, all autocomplete plugins and functions that I've found, they only update upon keyup/down, etc. This is fine but the search only begins occurring once the user has stopped typing and if they are typing a phrase or word, the script is unable to instantly start suggesting, etc. I know this'll be a very simple fix or suggestion ...

jQuery resizable() and multiple alsoResize's?

Hi, Is there a way to set multiple alsoResize's in jQuery UI? $('.selector').resizable({ alsoResize: '.other' }); I would like to set a couple of other elements to also resize, not just one. The official documentation tells nothing. ...

What to use instead of if(isset($_POST['submit'])) for this.form.submit()?

I want to run a particular block of PHP if the user submits a form. It works if I use a submit button with name="submit" and: <?php if(isset($_POST['submit'])) { code to run } ?> I don't know anything about javascript, and I want the code to run if the user changes a dropdown menu. If I make the first line of the dropdown <select n...

Get Weeks In Month Through Javascript

In Javascript, how do I get the number of weeks in a month? I can't seem to find code for this anywhere. I need this to be able to know how many rows I need for a given month. To be more specific, I would like the number of weeks that have at least one day in the week (a week being defined as starting on Sunday and ending on Saturday)....

How google detects that u are having slow connection, and suggest u to use basic html in gmail

Guys, if you have any idea about the logic behind the slow connection in gmail ...