如何将其他网站的值显示为html文件?

时间:2014-08-20 01:48:06

标签: javascript html javascript-events

如何在不同网站的新html文件中显示该值? This an example field of values that need to display into new html fileI want to display the said values in this page: jsfiddle位于两个输入html标记的顶部。

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

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

First 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 };
}
};

这是我的第二个JS:

 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 = "";
                }
            });
 }

注意:此值(contractID)每次都会更改..并且没有权限更改/自定义整个html所述网站

0 个答案:

没有答案