Questions tagged [document.write]

A DOM Level 2 HTML method that writes a string of text to a document stream opened by document.open().

A DOM Level 2 HTML method that writes a string of text to a document stream opened by document.open().

487 questions
233
votes
16 answers

Dynamically add script tag with src that may include document.write

I want to dynamically include a script tag in a webpage however I have no control of it's src so src="source.js" may look like this. document.write('
t adds a string sup to the myDiv div element. Which is what I want, exactly. However, this: function…
NPS
  • 6,003
  • 11
  • 53
  • 90
20
votes
9 answers

Why use document.write?

I was wondering why ad's still use the document.write approach to inserting the add into the page '); vs this: which site owners put on their site like http://example.com and in this javascript tag we want to dynamically include a third-party js such as which can…
Kuldeep Kapade
  • 1,095
  • 3
  • 12
  • 17
12
votes
9 answers

Recommended method to locate the current script?

I am writing a script that needs to add DOM elements to the page, at the place where the script is located (widget-like approach). What is the best way to do this? Here are the techniques I am considering: Include an element with an id="Locator"…
Christophe
  • 27,383
  • 28
  • 97
  • 140
11
votes
3 answers

What is the meaning of error TS2584 (TS) .... Try changing the 'lib' compiler option to include 'dom'?

I use VS and write Typescript I would like simply to type the command "document.write" without having an error code. what I having now is an error code of this commmand "document". I just don't want to get into something complecated as there can be…
Uri Gross
  • 484
  • 1
  • 8
  • 20
1
2 3
32 33