I’m trying to pass document.write as a reference to a variable:
Example:
var f = document.write
//then
f('test');
It works with alert. Why doesn’t it work with document.write?
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
In addition to what’s already said, Javascript 1.8.5 has a native solution for the problem : the bind function
The link above also contains emulation code for browsers that don’t support JS 1.8.5 yet.