RSS Forums RSS
Please support our HTML and CSS advertiser: Lunarpages Web Hosting
Views: 1248 | Replies: 3
Reply
Join Date: Mar 2007
Posts: 5
Reputation: sultanwadood is an unknown quantity at this point 
Rep Power: 0
Solved Threads: 0
sultanwadood sultanwadood is offline Offline
Newbie Poster

restore default (built-in) function after overriding

  #1  
Mar 26th, 2007
Hi all.
I need to know how to restore or roll back to built-in function after overriding like following example.
String.prototype.substr= function()
{ return "";}
Now I want to use the one already built-in.
I shall be very thankful if some one could help me.
Sultan Wadood
AddThis Social Bookmark Button
Reply With Quote  
Join Date: Mar 2007
Posts: 5
Reputation: sultanwadood is an unknown quantity at this point 
Rep Power: 0
Solved Threads: 0
sultanwadood sultanwadood is offline Offline
Newbie Poster

call built-in from overridden function of Object in javascript

  #2  
Mar 26th, 2007
Hi All.
Do any body know how to call built in function of object like substr from overridden version. I am trying following example but the function called itself recursively not the function being overridden.
String.prototype.substr= function(str)
{

return str.substr(0,5);
}

I shall be very thankful if some one could give me some hints.
Sultan Wadood.
Reply With Quote  
Join Date: Sep 2005
Posts: 716
Reputation: digital-ether has a spectacular aura about digital-ether has a spectacular aura about 
Rep Power: 6
Solved Threads: 44
Moderator
digital-ether's Avatar
digital-ether digital-ether is offline Offline
Master Poster

Re: restore default (built-in) function after overriding

  #3  
Mar 27th, 2007
I don't think its possible to revert to the old function unless you save it somewhere.

eg:

String.prototype._substr = String.prototype.substr;

String.prototype.substr= function()
{

return this._substr(0,5);
}
www.fijiwebdesign.com - web design and development and fun
Cpanel Email - Let users Register email accounts on your website upon registration
Ajax Chat - Fully browser based chat!
Reply With Quote  
Join Date: Mar 2007
Posts: 5
Reputation: sultanwadood is an unknown quantity at this point 
Rep Power: 0
Solved Threads: 0
sultanwadood sultanwadood is offline Offline
Newbie Poster

Re: restore default (built-in) function after overriding

  #4  
Mar 28th, 2007
my all poste problems have been solved.
thanks for helping and your valuable time.
Sultan Wadood.
Last edited by sultanwadood : Mar 28th, 2007 at 3:57 am.
Reply With Quote  
Reply

Only community members can participate in forum threads. You must register or log in to contribute.

Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)

 

Thread Tools Display Modes
Forums | Blogs | Tutorials | Code Snippets | Whitepapers | RSS Feeds | Advertising
All times are GMT -4. The time now is 5:41 am.
Newsletter Archive - Sitemap - Privacy Statement - Contact Us
Forum system based on vBulletin Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
©2003 - 2008 DaniWeb® LLC