javascript

submit forms in .NET

I have a .NET page that has a submit button. I am using client side validation to validate the form element. var register = $('#<%= Register.ClientId %>'); register.click(function(){ validation.init(); return false; }); Now, the return false on top prevents the form from being submitted to the server on click. In any other l...

Do I actually have a need for a Singleton?

I'm working on a Firefox extension where I'll want to keep multiple windows in sync with the same information. The toolbar queries a remote server for info periodically, based on when the window was opened. Because Firefox windows are all separately self-contained environments, each with their own toolbar running separate code I thought ...

Convert a JSON object to nested form fields?

Anyone know of a good way to convert a JSON object to nested form fields? For example, given I have the JSON object {'a':{'b':{'c':'1200'}}}, 'z':'foo', 'bar':{'baz':'1', 'id':2}} I should get {'a[b][c]':'1200', 'z':'foo', 'bar[baz]':'1', 'bar[id]':2}; Any ideas? I am currently using jquery and it feels like something like this alrea...

How can I construct an object using an array of values for parameters, rather than listing them out, in JavaScript?

Is this possible? I am creating a single base factory function to drive factories of different types (but have some similarities) and I want to be able to pass arguments as an array to the base factory which then possibly creates an instance of a new object populating the arguments of the constructor of the relevant class via an array. ...

Translate the following jQuery code to YUI 2.x code

Disclaimer: I have no experience using YUI at all. I was wondering how the following lines of jQuery code would look when written in YUI. Also, since YUI is using a hierarchical dependency system, which .js files need to be included in order for the code to work? 1. Given the ID of an HTML element, apply multiple style rules on the e...

Open New Window from aspx page from *any* URL

Is there any way to configure IIS or Web app to automatically open a new window when a hyper link is clicked? My issue isn't as trivial as it sounds, let me explain... I understand you can use javascript or target="_blank" in the anchor tag, but I don't always know when an anchor tag might be listed on the page... Reason is that its ...

Creating a Box Control over an area of the map with OpenLayers

I am using OpenLayers to create a box of interest with my program. I am using this code: var control = new OpenLayers.Control(); OpenLayers.Util.extend(control, { draw: function () { this.box = new OpenLayers.Handler.Box( control, {"done": this.notice}, {keyMask: OpenLayers.Handler.MOD_SHIFT}); ...

Using an PNG or JPEG for Map with OpenLayers (Scale/Zoom Problem)

I am using an image to display my map with OpenLayers. My JS code looks like this: map = new OpenLayers.Map('map'); var options = {numZoomLevels: 7, isBaseLayer: true, }; var globe = new OpenLayers.Layer.Image( 'Globe ESA', 'http://upload.wikimedia.org/wikipedia/commons/0/07/World_map_blank_blac...

New to Regular Expressions need help

I need a form with one button and window for input that will check an array, via a regular expression. And will find a exact match of letters + numbers. Example wxyz [some space btw] 0960000 or a mix of numbers and letters [some space btw] + numbers 01xg [some space btw] 0960000 The array has four objects for now. Once found i n...

Randomizing elements in an array?

I've created a site for an artist friend of mine, and she wants the layout to stay the same, but she also wants new paintings she'd produced to be mixed into the current layout. So I have 12 thumbnails (thumb1 - thumb12) on the main gallery page and 18 images (img1 - img18) to place. The approach I thought of was to create an array of ...

How can I know whether the scroll of the user is UP or DOWN?

Hi, I want to determine the scroll of the users. I'm using jQuery.. And jquery have .scroll event.. But the .scroll event can't determine whether the user is scrolling the page downwards or upwards. ...

GInfoWindow maxContent dependent on the currently selected tab

I'm using Google Maps API to display a map and some markers on it. When the user clicks a marker, I use the openInfoWindowTabsHtml of my GMap2 object to display the little balloon, with tabs. I also pass in a maxContent to openInfoWindowTabsHtml, so the baloon becomes maximizable. Now my problem is, I would like the maximized content to...

how to create rich text area dynamically in client browser

i am uses wysiwg... rich text area and i want to create it dynamically at run time also i uses FCKeditor and try to create new rich text area at run time but here i can' create dynamic rich text area at run time in browser also when i create new one data in old rich text area mist be persist its value ...

Inserting HTML elements with JavaScript

Instead of tediously search for workarounds for each type of attribute and event when using the following syntax: elem = document.createElement("div"); elem.id = 'myID'; elem.innerHTML = ' my Text ' document.body.insertBefore(elem,document.body.childNodes[0]); Is there a way where I can just declare the entire HTML element...

how to read data from url using javascript.

Im trying to pass data from one page to another. www.mints.com?name=something How to read name using javascript. ...

How can I call javascript method from my aspx.cs file

I have a javascript method which I have to call from the aspx page at the time of page load. ...

document.getElementById doesnt seem to work

I am trying to execute this but cant see any result: <script> function init() { document.getElementById('welcome').innerHTML = "<font color=white>Logged As:"+ param + "</font>"; } window.onload = init; </script> <body> ........... <div class="span-24 bottom_header" id="welcome"></div> ........... </bo...

IE:"This.container" is null or not an object

Hi there! I have this error in IE7 not in Firefox3 it says "This.container" is null or not an object at line 77 of character 3 of php file. The line 77 is as follows: <input name="news_title_txt" type="text" class="fieldcell_" id="news_title_txt" size="50" ></td> ...

Animating Background Image

I Like using Jquery and its companion Jquery Ui but can not find a way to animate background image over a certain period of time like 5 seconds. I can not do something like: $('sampleelement').animate({'background-image':'url(hello.jpg)'},5000); Any ideas?? ...

Looking for customizable syntax highlighting in the browser

I'm looking for a customizable JavaScript script which dynamically highlights code in a block like <code class="someclass">source code...</code> It needs to be customizable because the source code is in a quite esoteric programming language (Mozart/Oz). Ideally, I'd just edit some regexes to make it work. I need dynamic highlighting b...