943,981 Members | Top Members by Rank

Ad:
Mar 26th, 2007
0

restore default (built-in) function after overriding

Expand Post »
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
Similar Threads
Reputation Points: 10
Solved Threads: 0
Newbie Poster
sultanwadood is offline Offline
5 posts
since Mar 2007
Mar 26th, 2007
0

call built-in from overridden function of Object in javascript

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.
Reputation Points: 10
Solved Threads: 0
Newbie Poster
sultanwadood is offline Offline
5 posts
since Mar 2007
Mar 27th, 2007
0

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

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. }
Moderator
Reputation Points: 457
Solved Threads: 101
Nearly a Posting Virtuoso
digital-ether is offline Offline
1,250 posts
since Sep 2005
Mar 28th, 2007
0

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

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.
Reputation Points: 10
Solved Threads: 0
Newbie Poster
sultanwadood is offline Offline
5 posts
since Mar 2007

This thread is more than three months old

No one has posted to this discussion for at least three months. Please let old threads die and do not reply to them unless you feel you have something new and valuable to contribute that absolutely must be added to make the discussion complete. Otherwise, please start a new thread in this forum instead.
Message:
Previous Thread in HTML and CSS Forum Timeline: Browser Compatibility Problems
Next Thread in HTML and CSS Forum Timeline: opacity





About Us | Contact Us | Advertise | Acceptable Use Policy
Forum Index | Build Custom RSS Feed


Follow us on Twitter


© 2011 DaniWeb® LLC