Innerhtml and innertext are often used to attack the system. What is the difference between them?
< Html > < Head > < Title > New Document </ Title > < Meta Name = "Generator" Content = "Editplus" > < Meta Name = "Author" Content = "" > < Meta Name = "Keywords" Content = "" > < Meta Name = "Description" Content = "" > </ Head > < Body > < Table ID = "Curedata" > < Tr > < TD > A </ TD > < TD > AA </ TD > < TD > Aaa </ TD > </ Tr > < Tr > < TD > B </ TD > < TD > Bb </ TD > < TD > Bbb </ TD > </ Tr > </ Table > < Input Type = "Button" Value = 'Display' ID = 'Btn' Onclick = "Getfirstrowinfo ();" /> </ Body > </ Html > < Script Type = 'Text/JavaScript' > Function Getfirstrowinfo (){ VaR TRS = Document. getelementbyid ( ' Curedata ' ). Getelementsbytagname ( ' Tr ' ); VaR Firstid1 = TRS [ 1 ]. Cells [ 0 ]. Innertext; VaR Firstid2 = TRS [ 1 ]. Cells [ 0 ]. Innerhtml; alert (firstid1 + " ... 1 " ); Alert (firstid2 + " ... 2 " );} </ Script >
Click:
① In IE8, the display effect is:
② In Chrome, the display effect is:
③ Show the effect under Firefox:
This is the difference.