javascript

<canvas> Go/Baduk/Weiqi Game Board

I'm experimenting a bit with the new tag and I've already hit my first roadbump. I figured I'd start getting my feet wet by implementing a version of the classic board game Go/Baduk/Weiqi. I've drawn the xy grid using moveTo() and lineTo(), and I've drawn a wood background using fillRect() that needs to be "under" that XY grid of cours...

How do I make a full DIV clickable with an anchor...but inside that DIV, have an input button that doesn't follow that anchor?

I tried this: <div style="display:block;"> <a href="/go" style="display:block;height:100%;width:100%;position:absolute;"></a> LOTS OF STUFF HERE <input type="button" onclick="runsomething();return false;"> </div> But it doesn't work. It does click to follow the anchor...but the button also follows anchor, which I don't want. Edit:T...

A curious problem occurring related to document.form.submit() in ASP. Please help. Thanks.

There are 3 buttons on a web page. On clicking each button a same popup window (say window1) opens up. Now there is another button on this popup window (window1), which further opens up to another popup window (say window2). On selecting some value from the 'window2', that value is passed onto the 'window1'. There is a 'Find' link on a '...

Javascript subclassing and createElement

Hello. function A() { this.myProp = document.createElement("div"); } function B(id) { this.myProp.id = id; document.body.appendChild(this.myProp); } B.prototype = new A(); window.onload = function() { new B("hello"); new B("goodbye"); } What happens here is that I end up with one div with id "goodbye". What I wo...

from HTML send an event plus variable to JS function

Hi , I want to send a mouse event and a variable to a JS function from within my html code, i can send the event fine but the problem is sending the event AND a variable. I have included a stripped down version of what I am trying to do. The browser is chrome. Can anyone offer some advice please ??` function mouseDown(e,w) { var ctr...

How do I set a width for the mobile AND the desktop?

Right now, the width of my DIV is 100%. It's great on mobile. It stretches, and it doesn't require the user to scroll left or right. It just "fits". However, on a big monitor...the DIV is stretched out, and all the stuff on float:left are to the left, whereas all the float:right are all the way to the right! I would like a style solu...

JavaScript Folding Menu Tree

This is a JavaScript function for menu tree. I would like to add more sub-menu in it, not only one sub-menu. What's x.all[0] and x.all[2]? var head="display:''" img1=new Image() img1.src="fold.gif" img2=new Image() img2.src="open.gif" function change(){ if(!document.all) return if (event.srcElement.id=="folding"){ v...

HTML selection option with javascript doesn't work in IE

hallo, can somebody help me. I try to make some thing happen when i click on anders(value 0), than something need to be vissible. It works in firefox but not in IE <select id="budget" name="budget"> <option value="0" onclick="anders('1')">Anders</option> <option value="200" onclick="anders('');" selected="selected">&#8364; 200,-</option...

JavaScript: When assigning an anonymous function to a variable, function return value is not passed, rather the function as a string.

Hi SO, I am trying to learn JavaScript but I've come across a hurdle. If the answer is obvious and reachable through a simple search I apologize in advance. I am a novice to programming and JavaScript, and unsure what line of inquiry to follow. In the following code, the function takes values from a HTML form, does some processing and ...

How to sort an array of objects based on a the length of a nested array in javascript

I have an array of objects in javascript, each of which in turn has an array: { category: [ { name: "Cat1", elements : [ { name: name, id: id } ] }, { name: "Cat2", elements : [ { name: name, id: id }, { name: name, id: id }, { name: name, id: id } ] ...

help with making this regExp in js

I need to compare a textarea to make sure: It's not ONLY SPACES and not ONLY RETURNS(new lines) and NOT ONLY a combination of these two. However, if there are more than 3 characters OR numbers, then it is okay. Not more than say 2000 characters. Imagine a textarea, I don't want the form to submit if the user have pressed enter (new l...

Any tool to add linenumbers in jquery

All, Is there any tool to add line numbers in jquery to a textarea. Thanks.. ...

How does JavaScript `Date` object determine the locale of the users browser?

I am trying to understand how the JavaScript running in the various browsers determines the locale that will be used by the JavaScript Date object when using the method toLocaleString. I have changed the language and locale settings of my system through windows control panel and I have also changed every browsers language settings to t...

Distance Math in JavaScript and Implementing it in loop?

Hi! I'm having the difficulties with calculating distance between several points on the map: I have an array of coordinats where the first coord ["30.327547", "59.919676"] is the begining of the trip and other are pit stops: var J = [ ["30.327547", "59.919676"], ["29.84964", "58.737619"], ["28.250252", "57.785994"], ["3...

How should I define a JavaScript 'namespace' to satisfy JSLint?

I want to be able to package my JavaScript code into a 'namespace' to prevent name clashes with other libraries. Since the declaration of a namespace should be a simple piece of code I don't want to depend on any external libraries to provide me with this functionality. I've found various pieces of advice on how to do this simply but non...

How to Determine duplicate Javascript Functions which include in Asp.net Page

I have an application which use some javascript functions, As all javascripts include in Masterpage, most of them which comes withpage are not necessary, and some of those are repeated ( cause used in some different JS file. ) So I want to check if there is a way to determine duplicate functions and remove them ? ...

How to load Javascript Files in client system once and reuse them ?

I have a large scale application which uses javascript for many reasons. these javascript files included in some JS files and JS files imported to Asp.net Masterpage files. this JS files contents (javascript functions) will add to page when page display to user, so a Bunch of waste Javascript functions will include in Asp.net pages. I'...

Why does this expression return true?

Possible Duplicate: Can somebody explain this Javascript method ? (x = [].reverse)() === window // true Any idea why? ...

Javascript syntax (2 minute question)

Hi, I'm trying to work with openstreetmap through openlayers, and I have encountered a biit of Javascript syntax that I don't understand (I'm no expert with Javascript - just beginning to learn how it handles objects at the moment...) Here it is anyway... map = new OpenLayers.Map ("map", { controls:[ new OpenLayers.Control.Navigati...

Action and confirmation - different pages, how do I pass text?

Hello. I have my integrated my site with phpbb, so you login into phpbb, and then you will be able to see my site, so I do not use normal sessions, so I do not know how to do this. My site is a design at index.php, and then I have an insert.php inside a frame. Now at my index.php, I want to receive a message, and at insert.php, I want ...