restore default (built-in) function after overriding

Reply

Join Date: Mar 2007
Posts: 5
Reputation: sultanwadood is an unknown quantity at this point 
Solved Threads: 0
sultanwadood sultanwadood is offline Offline
Newbie Poster

restore default (built-in) function after overriding

 
0
  #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
Reply With Quote Quick reply to this message  
Join Date: Mar 2007
Posts: 5
Reputation: sultanwadood is an unknown quantity at this point 
Solved Threads: 0
sultanwadood sultanwadood is offline Offline
Newbie Poster

call built-in from overridden function of Object in javascript

 
0
  #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 Quick reply to this message  
Join Date: Sep 2005
Posts: 1,050
Reputation: digital-ether is just really nice digital-ether is just really nice digital-ether is just really nice digital-ether is just really nice 
Solved Threads: 65
Moderator
digital-ether's Avatar
digital-ether digital-ether is offline Offline
Veteran Poster

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

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

eg:

HTML and CSS Syntax (Toggle Plain Text)
  1. String.prototype._substr = String.prototype.substr;
  2.  
  3. String.prototype.substr= function()
  4. {
  5.  
  6. return this._substr(0,5);
  7. }
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 Quick reply to this message  
Join Date: Mar 2007
Posts: 5
Reputation: sultanwadood is an unknown quantity at this point 
Solved Threads: 0
sultanwadood sultanwadood is offline Offline
Newbie Poster

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

 
0
  #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 Quick reply to this message  
Reply

This thread is more than three months old.
Perhaps start a new thread instead?
Message:



Similar Threads
Other Threads in the HTML and CSS Forum
Thread Tools Search this Thread



About Us | Contact Us | Advertise | DaniWeb | Acceptable Use Policy | RSS Feed

©2003 - 2009 DaniWeb® LLC