Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/javascript/469.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Javascript 如果我们有任何方法从html运行一个函数,从外部html页面的onclick事件?_Javascript_Java_Php_Html_Json - Fatal编程技术网

Javascript 如果我们有任何方法从html运行一个函数,从外部html页面的onclick事件?

Javascript 如果我们有任何方法从html运行一个函数,从外部html页面的onclick事件?,javascript,java,php,html,json,Javascript,Java,Php,Html,Json,我有两个html文件a.html,b.html我可以从b.html文件中单击一次来编辑a.html元素吗? 如果可能的话 <!DOCTYPE html> <html> <body>s <button onclick="myFunction()">Click me</button> <p id="demo"></p>

我有两个html文件a.html,b.html我可以从b.html文件中单击一次来编辑a.html元素吗? 如果可能的话

<!DOCTYPE html>
    <html>
    <body>s
    
     <button onclick="myFunction()">Click me</button>
    
     <p id="demo"></p>
    
     <p>A function is triggered when the button is clicked. The function outputs some text in a p 
     element 
     with id="demo".</p>
    
     <script>
     function myFunction() {
      document.getElementById("demo").innerHTML = "Hello World";
     }
     </script>
    
    </body>
    </html>

s
点击我

单击按钮时会触发一个功能。该函数以p格式输出一些文本 元素 使用id=“demo”

函数myFunction(){ document.getElementById(“demo”).innerHTML=“Hello World”; }
  • localStorage.setItem
  • 加法器

  • 你能澄清一下你想要实现什么吗?你能告诉我这与
    java
    有什么关系吗?对不起,至少需要5个标签,我不知道更多与此相关的内容,所以我只需要填写一个标签。我很抱歉,请尝试给出一些解释,以便任何未来的听众或提问的人都知道你到底想说什么。