문제

When I write in the URL bar

javscript:document.getElementById("existing_elementid").innerHTML = "some text";

my browser doesn't change the innerHTML of the object but removes the whole page and set "some text" instead.

After that the source code looks like this:

<html>
 <head></head>
 <body>
  some text
 </body>
</html>

Edit:

  1. Before it forwards to this empty site, I can see that the command was normal executed (the content of existing_elementid was changed to "some text").
  2. When I tried to do the same on the console, the result was the desired one. But the console also gave me the answer "some text". Maybe the problem is that bookmarklet gives it answers as new pages?
도움이 되었습니까?

해결책

whoa, i hope there's a better solution to this, but.. this seems to work.. (right on this stackoverflow page, in fact)

javascript:document.querySelector("#nav-questions").innerHTML="test";window.stop();

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top