MacGoose Posted June 4, 2010 Share Posted June 4, 2010 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 More sharing options...
Synook Posted June 4, 2010 Share Posted June 4, 2010 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 More sharing options...
MacGoose Posted June 4, 2010 Author Share Posted June 4, 2010 You need an assignment operator between the symbol name and the function literal. this.search = function( address ) { ... do search and populate markers } Thanx! , MacGoose Link to comment Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.