在js里再引入js 文件(代码库)
function addScript(url){
var script = document.createElement('script');
script.setAttribute('type','text/javascript');
script.setAttribute('src',url);
document.getElementsByTagName('head')[0].appendChild(script);
}
登录日志记录ip和 城市,并且改成页面加载完毕以后再执行
需要延时一秒读数据,否则会出现有时读不到数据的问题
window.onload = function onLoginLoaded() {
var script = document.createElement('script');
script.setAttribute('type', 'text/javascript');
script.setAttribute('src', "https://pv.sohu.com/cityjson?ie=utf-8");
document.getElementsByTagName('head')[0].appendChild(script);
setTimeout(function () {
var keyTmp = RSAUtils.getKeyPair(exponent, '', modulus);
var keyValue = returnCitySN["cip"] + "|" + encodeURIComponent(returnCitySN["cname"]);
document.getElementById("real").value = RSAUtils.encryptedString(keyTmp, keyValue);
}, 1000);
}