Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/javascript/431.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

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/3/html/76.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文件中?_Javascript_Html_Javascript Events - Fatal编程技术网

Javascript 如何将其他网站的值显示到html文件中?

Javascript 如何将其他网站的值显示到html文件中?,javascript,html,javascript-events,Javascript,Html,Javascript Events,如何在不同网站的新html文件中显示值?在两个输入html标记的顶部 我想在此输入框中显示上述值: <div class="block"> <label>Contract Id:</label> <input type="text" value="" readonly> </div> <a href="">Save New Address</a>

如何在不同网站的新html文件中显示值?在两个输入html标记的顶部

我想在此输入框中显示上述值:

   <div class="block">
        <label>Contract Id:</label>
        <input type="text" value="" readonly>
        </div>
        <a href="">Save New Address</a>

注意:此值收缩,每次都会更改。。并且没有权限更改/自定义上述网站的整个html

如果不是JSONP,您不能使用CORS,则需要使用服务器端语言来获取其他网站的页面。就价值而言,无论你想描述什么,都没有多大意义。像这样此js扫描和一些值。。而这将显示从第一个链接到谷歌地图搜索框的值
function scanLapVerification() {
try {
 //check if the page is activity where address check is done
  var page_title = "Title";
  var el = getElement(document, "class", "view-operator-verification-title", "");
  if (!el || el.length == 0) return;
  if (el[0].innerText != page_title) return;
  var page_title = '';
  var el = getElement(document, "class", "workflowActivityDetailPanel", "");
  if (el && el.length > 0) {
  var eltr = getElement(el[0], "tag", "tr", "");
  if (eltr && eltr.length > 0) {
      //Read Contract ID
      var contractId = {
          CI: { id: null }
      };
      var con_id = null;
      for (var i = 0; i < eltr.length; i++) {
          tr_text = eltr[i].innerText;
          if (tr_text.substr(0, "Contract ID".length) == "Contract ID") con_id = "CI";
          if (con_id && tr_text.substr(0, "Contract ID".length) == "Contract ID") {
              contractId[con_id].id = tr_text.substr("Contract ID".length + 1, tr_text.length - "Contract ID".length - 1);
          }
      }
      var contract_id = contractId.CI.id;
      return { content: "cid_check", con_id: con_id };
    }
    return { status: "KO" };
 } catch (e) {
        alert("Exception: scanLapVerification\n" + e.Description);
    return { status: "KO", message: e };
}
};
 function scanLapVerification() {
 chrome.tabs.sendRequest(tabLapVerification, { method: "scanLapVerification" },
    function (response) {
        msgbox("receiveResponse: scanLapVerification " + jsonToString(response, "JSON"));
        //maintaining state in the background
        if (response.data.content == "cid_check") {
                //Popup window features
                var popupWindow = null;
                var newAddress;
                var width = 550;
                var height = 200;
                var left = parseInt((screen.availWidth / 2) - (width / 2));
                var top = parseInt((screen.availHeight / 2) - (height / 2));
                var windowFeatures = "width=" + width + ",height=" + height + ",left=" + left + ",top=" + top + "screenX=" + left + ",screenY=" + top;

                //Input new address with popup window
                if (confirm("Does the client has new address?") == true) {
                    popupWindow = window.open('/htmlname.htm', "title", windowFeatures + encodeURIComponent(response.data.contract_id));
                    popupWindow.focus();
                } else {
                    obname = "";
                }
            });
 }