Recent Topics

1 Feb 03, 2007 02:00    

There is

			if( post_title_elt = document.getElementById('post_title') )
		{
			/**
			 * Updates document.title according to the item title field (post_title)
			 */
			function evo_update_document_title()
			{
				var posttitle = document.getElementById('post_title').value;

				document.title = document.title.replace( /(New post in blog\:).*$/, '$1 '+posttitle );
			}

			addEvent( post_title_elt, 'keyup', evo_update_document_title, false );

			// Init:
			evo_update_document_title();
		}

So

var posttitle = document.getElementById('post_title').value;

Should be replaced with

var posttitle = post_title_elt.value;

As document.getElementById searches all the elements in the page for the one with that id and then returns a reference to it.

So using document.getElementById once you already have a object reference to the element is just wasting time.


Form is loading...