Jump to content

OOP...?


MacGoose

Recommended Posts

Hi!I know OOP in C++. And by example I'm trying to do some OOP in JavaScript. This is my code, and it does not work, hehe:

var addressdata = 0;function searchAddress( form ) {	if( addressdata ) addressdata.clear();	addressdata = new AddressSearch();	addressdata.search( form.address.value );}function showPrevResult() {	if( addressdata ) addressdata.prev();}function showNextResult() {	if( addressdata ) addressdata.next();}function clearAddressSearch() {	if( addressdata ) addressdata.clear(); addressdata = 0;}function AddressSearch() {	var index = 0;	var markers = new Array( 10 );	this.next function() {		...		iterate markers	}	this.prev function() {		...		iterate markers	}	this.clear function() {		...		clear markers	}	this.search function( address ) {		...		do search and populate markers	}}

You probably can see what I'm trying to do and hopefully what I'm doing right. It is so much different from C++ OOP. Any help appreciated.TIA!, MacGoose

Link to comment
Share on other sites

You need an assignment operator between the symbol name and the function literal.

	this.search = function( address ) {		...		do search and populate markers	}

Link to comment
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...