javascript

launch two actions in one button ASP.NET

Hey, I'm developing a comment page in asp.net, this my page : <form action="#"> <p><textarea id="textArea" rows="5" cols="30"></textarea></p> <input type="submit" value="Submit" /> </form> <p>Add some comments to the page</p> And this is my javascript code : window.onload = initAll; function initAll() { document.getElementsByTagNam...

Validating age field

Hi people, I'm trying to validate an age field in a form but I'm having some problem. First I tried to make sure that the field will not be send empty. I don't know JavaScript so I searched some scripts and adapted them to this: function isInteger (s) { var i; if (isEmpty(s)) if (isInteger.arguments.length == 1) return 0; ...

JS and Rails site wide announcements

Tried doing http://davidwparker.com/2008/09/17/site-wide-announcements-in-rails-using-jquery-jgrowl/ Am really bad with JS. Think I am messing up on the last part where it says "This code goes in your application.js file (somewhere in $(function){ //here })" Am I not suppose to do a link_to_function and create a function with this cod...

my jquery code dont work?

UCCN1003Edit <script type="text/javascript"> $(function(){ $('a.edit').click(function(event){ var change = $(this).parent('div').find('p'); var changeText = change.text(); var wrapper = $(this).parent('div'); var clone = change.clone(true); var changeBox = $(...

What do you call a set of Javascript closures that share a common context?

I've been trying to learn closures (in Javascript), which kind of hurts my brain after way too many years with C# and C++. I think I now have a basic understanding, but one thing bothers me: I've visited lots of websites in this Quest for Knowledge, and nowhere have I seen a word (or even a simple two-word phrase) that means "a set of J...

Problem on Loading Map Into div

I'm using Google Maps API v3. When I'm loading map into a div, it doesnt load as I expected.. The map area takes the whole div, but the map only loads into top left of the div(only a part).. All the controls including zooming, are loading normally, How can I fix this ? ...

Maximum execution time for JavaScript

I know both ie and firefox have limits for javascript execution (Source 1, Source 2). Based on number of statements executed, I heard it was 5 million somewhere in IE and based on number of seconds in firefox: it's 10 seconds by default for my version. The thing I don't get is what cases will go over these limits: I'm sure a giant loo...

Keeping a web app project organized?

Hi, I'm writing a web app, using jsp to create the page content. I need a pretty good amount of javascript to make the app work. Does anyone have any recommendations on how to structure my project, such that it doesn't become a mess? This is a broad question, but the basic problem is that I'm insert javascript code directly into my jsp...

Determine mouse click for all screen resolutions

I have some simple javascript that determines where a click happens within a browser here: var clickDoc = (document.documentElement != undefined && document.documentElement.clientHeight != 0) ? document.documentElement : document.body; var x = evt.clientX; var y = evt.clientY; var w = clickDoc.clientWidth != undefined ? ...

constructor function's object literal returns toString() method but no other method

I'm very confused with javascript methods defined in objects and the "this" keyword. In the below example, the toString() method is invoked when Mammal object instantiated: function Mammal(name){ this.name=name; this.toString = function(){ return '[Mammal "'+this.name+'"]'; } } var someAnimal = new Mammal('Mr. Biggles'); alert...

object required error

where is error? <iframe src="jquerytabs/index.html" name="bulten" scrolling="auto" id="ifr2" frameborder="0" style="width:100%;" marginheight="0" marginwidth="7" height="288" ></iframe> <script type="text/javascript"> document.write(parent.document.getElementById('ifr2').src) --->error is here but how can I correct? </script> ...

Jquery each loop with json array

I'm trying to use Jquery's each loop to go through this JSON and add it to a div named #contentHere. The Json is as follows: { "justIn": [ { "textId": "123", "text": "Hello", "textType": "Greeting" }, { "textId": "514", "text":"What's up?", "textType": "Question" }, { "textId": "122", "text":"Come over here", "textType": "Order" }...

Ideas on limiting content to single printed page?

I have 5-6 text areas that users fill out in a template (a couple of columns, basically a newsletter format). I'm needing to limit their content to one printed page, but I'm having a hard time coming up with practical solutions. The printed format (margin, font size, etc.) will be the same for all users, as it's printed from a central so...

Cufon textShadow + hover problem

I only want the text-shadow to be on the hover state. here's the example page: http://dev.reggi.com/ex/cufon/cufonexample.html **JS** Cufon.replace('.headerright', {hover: true,'fontFamily' : 'League Gothic',textShadow:'0px 1px #cccccc'}); **CSS** .headerright{text-transform:uppercase; font-size:76px;color:#CD7674;} .headerright a:hov...

Random <hr/> that I don't know how to get rid of!

I have just searched the document to find it, I removed the <hr class="cmdbar"></hr> but it is still there! Do any of you see anything else? <?php print "<?xml version=\"1.0\" encoding=\"UTF-8\"?>"; ?> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "DTD/xhtml1-strict.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"&gt; <fon...

Is there a better way to select tables based on how many rows they have via jQuery?

I'm looking to grab a group of tables that have more than X rows with jQuery. Currently, I'm doing something similar to: $("table").each(function(){ if($(this).find("tr").length > x){ tableArray[tableArray.length] = $(this); } }); and then acting on the members of the tableArray. Is there a better way of getting these tables,...

How to access core data objects from Javascript?

How can I gain access to Core Data objects from Javascript/WebKit on Mac OS X? I've made custom subclasses of NSManagedObject for each of my tables, with accessors defined using @property/@dynamic for each attribute, but neither isSelectorExcludedFromWebScript: or isKeyExcludedFromWebScript: is called for any of them, so Javascript just...

javascript callback after loop

Hey guys, Iv'e just started a new Wordpress blog and i have started to build the JavaScript base! the issue im having is that i have a fucntion that loops several variables and includes the required JS libraries, what i need to do is execute the callback when the loop is finished! Heres my code! var Utilities = { Log : function(i...

Grabbing current URL and setting it to Textbox in the HTML frame using Google Chrome extension.

Hi all, Question says it all, dividing it into two parts: 1- Grabbing url when chrome extension is clicked, of current tab(on focus) - CHROME SPECIFIC. 2- Setting the same in a Textbox value, in one of frames of web page.Which means, the textbox resides in a.html where on webpage it's <frame src="a.html"> -CHROME/JAVASCRIPT/HTML spec...

javascript: how to check all code of an html page is loaded

the program needs invoke a function after all code, including HTML, javascript, CSS, etc., is loaded? Can javascript do it? ...