javascript

html5 canvas element how to get width and height

hello, how can i get the width and height of the canvas element in javascript? also, what is the "context" of the canvas i keep reading about? thanks! ...

sharepoint customzing signout.aspx

hi all, I want to customize the sign out functionality in sharepoint. I want to redirect to Home page after signout button is clicked. I used the following code : function _spBodyOnLoad() { try { document.execCommand("ClearAuthenticationCache"); window.location=home page url; } catch (e) {} } but the problem her...

How to sort associative array in Javascript?

Hi, I need to sort associative array by JS for one of my projects. I found this function, that works great in firefox, but unfortunately it doesnt work in IE8, OPERA, CHROME... Cant find the way to make it work in other browsers, or find another function that would fit the purpose. I really appreciate any help. function sortAssoc(aInpu...

How to include an already documented method in jsdoc-toolkit?

I have a JavaScript singleton object created with closure method: /** * This is the singleton. * * @namespace window.Something.Singleton */ window.Something.Singleton = (function() { /** * Foo method. * * @return {String} this method always returns with <code>bar</code> */ function _foo() { return "bar"; } /** ...

Hidden value is passing while the div's display style is none using PHP

Hi all, Here is my JS: <script type="text/javascript"> function display(action, id) { if (action == 'show') { document.getElementById("explanation"+id).style.display = "block"; document.getElementById("link"+id).href= "javascript:display('hide', "+id+")"; document.getElementById("link"+id).innerHTML = "Close"; } if (action =...

jqplot changes the color of graph on mouse hover

jqplot changes the color of the fill when mouse hovers... I want to remove that effect.. How ?? here is the options used. : var options={ series: [{ neighborThreshold: -1, shadowAngle:0, shadowOffset:2.5, shadowAlpha:.05, ...

Expanding Background whilst keeping original aspect ratio

I would like to be able to set a background on our homepage which can expand and contract with the window size whilst keeping the original images aspect ratio.... I'm guessing this will need some clever Javascript or similar. The effect has been implemented here whereby then the window exceeds around 1500 pixels in width the background ...

Adjust height on jQueryUI dialog to be as tall as content up to a max

Using jQueryUI's dialog boxes, I want to popup information. My problem is I want to set the height of the dialog to however high the content is. If I don't specify a height, this works perfect. The height is automatically calculated based on the height of the content. Problem then is if the content is very tall, the dialog gets very ...

how to set css z index as its parent z index

how to set the zindex value of the child div's greater than parent div. where parent zindex differs. ...

List of sites which pay for articles.

There are nice sites where to get information about javascript, html, css. I can think of some: http:// www.alistapart.com http:// www.smashingmagazine.com http:// www.sitepoint.com If you write an article for them (sharing some of your developer know-how) you are going to get paid. Can somebody add up similar sites ? I would li...

Javascript - animation stops as new one is started

Hi all, I have a UL on a page and on the click of a button I am appending an li and fading it in. This works fine for single clicks. However, when the button is clicked twice, the first animation immediately stops and the second completes. I have setup a test page to demonstrate this: http://anttears.co.uk/test (the test page has been t...

why JavaScript is not displaying parsed json data?

This is format of JSON data: [{"options":"smart_exp"},{"options":"user_int"},{"options":"blahblah"}] that I receive through getjson from server. I need to append json with user input. I am trying to do it in this way: 1st convert it into javascript object, append it with user input, again convert to json object & send it back to server f...

Jquery/Javascript

Good morning peoples. I have a bit of a slight jQuery question/problem that I am not sure how to tackle. I have a click handler bound to varying classes on some anchor tags (which works great). I have now come to a page that needs an extra handler on the same anchor tags so I decided to use some namespacing to get the desired result. T...

Javscript prevent drag and drop outside browser window

I've got a dialog screen which is placed on top of my web page. This dialog can be dragged around the page, but also outside the visible part of the page. How can I detect the 'limits' of the browser window and prevent dragging the dialog outside the page? The following part of an case statement is exectuted when I drop the dialog windo...

Get list item index in HTML ul list using Javascript

I have the following HTML page: <html> <head> <script type="text/javascript" src="JavaScript/Menu.js"></script> </head> <body> <ul> <li><a onclick="GetIndex(this)">One</a></li> <li><a onclick="GetIndex(this)">Two</a></li> <li><a onclick="GetIndex(this)">Three</a></li> ...

advancing to button code-behind when validation fails... how to solve it without Page.IsValid?

Hello! I have an ASP .NET page with both asp .net validators and some javascript checking too. I am advancing into the button code behind: protected void Button2_Click(object sender, EventArgs e) { if (Page.IsValid) { /// ... Even when the validation fails! The Page.IsValid check solves it, but it also ...

Cycle through int values

I need some input. Say you have an int-based Enum with values 1 through 10. If you then have a variable that is, say, value corresponding to 7, how can you easiest set it to next value in the given range without going out of bounds? If the value reaches the limit, it should reset itself to first in the range. I want a one-liner solutio...

Javascript - what kind of declaration is this?

I come from other programming languages and I am new to Javascript. I am trying to understand what a Javascript code is doing. I found this line var guiTouchPos : Vector2 = touch.position - guiTouchOffset; What kind of declaration is this? What is this line doing? Wouldn't it be easy to write var guiTouchPos = touch.position - guiTo...

Web service call with Query Ajax hangs.

Before I start posting a ton of code I think I may be able to explain my situation more logically. I have eight drop downs on a page being populated in exactly the same way except they are using different stored procs. The ones that return a LOT of rows (around 44000 but each rows is only about an average of 5 characters) are the ones th...

Set focus to end of text in textbox after postback?

I've got a simple ASP.Net form with txtBox and btn. User click btn, which adds text to an ASP:TextBox in a postback (its adding a known "starter text". After the postback I'd like the focus to be set to the end of the text in the textbox. If I call Page.SetFocus(...) or txtBox.Focus() then the txtBox gets focus, but at the beginning of ...