Welcome to the Treehouse Community
Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.
Looking to learn something new?
Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.
Start your free trialSascha Lamparter
Front End Web Development Techdegree Graduate 15,570 PointsWhat excatly does the print function?
Is it always putting HTML virtualy in your HTML-document? Or is it just putting data on the website - but if it is second, what the difference to document.write? Thanks a lot.
2 Answers
john larson
16,594 Points- Is it always putting HTML virtualy in your HTML-document? I believe that is exactly what it is doing. Or maybe it's something like: it provides data to the browser that interprets it as html in the document. Some one else could probably answer better, but I liked your question.
- difference to document.write? document .write always loads a certain way and displays at a certain place. I forget the exact details of that. But: when you use innerHTML, which I believe is what I believe you are referring to, you have complete control over where the html is placed and it doesn't interfere with how the page loads. (document.write does)
Sascha Lamparter
Front End Web Development Techdegree Graduate 15,570 PointsHu John, Thanks a lot for your input. Best Sascha
john larson
16,594 Pointsjohn larson
16,594 PointsHi Sascha, did I understand your question? or was there something else about document.write and the print function. I know he does it a few different ways. document.write is not used any more except in testing. there is a print function Dave uses with document.write, but he later changes document.write to innerHTML. I think the point he's making is by using functions, if a better way to do something comes out, you only have to change one function.