1
0

iframe.html 2.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748
  1. <!DOCTYPE html>
  2. <html lang="">
  3. <head>
  4. <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
  5. <meta http-equiv="X-UA-Compatible" content="IE=10" />
  6. <script type="text/javascript">
  7. function doSubmit() {
  8. var username = document.getElementById("username").value; //获取输入的用户名
  9. var password = document.getElementById("password").value; //获取输入的参数
  10. var scr = document.createElement("iframe"); //创建iframe
  11. scr.src =
  12. "https://202.99.219.114:28888/qjny/report/login/cross/domain?fine_username=" +
  13. encodeURIComponent(username) +
  14. "&fine_password=" +
  15. encodeURIComponent(password) +
  16. "&validity=" +
  17. -1 +
  18. "&callback=callback"; //将报表验证用户名密码的地址指向此iframe
  19. if (scr.attachEvent) {
  20. //判断是否为ie浏览器
  21. scr.attachEvent("onload", function () {
  22. //如果为ie浏览器则页面加载完成后立即执行
  23. window.location = "https://202.99.219.114:28888/qjny/report"; //直接跳转到数据决策系统
  24. });
  25. } else {
  26. scr.onload = function () {
  27. //其他浏览器则重新加载onload事件
  28. /*跳转到指定登录成功页面,index.jsp
  29. var f = document.getElementById("login");
  30. f.submit(); */
  31. window.location = "https://202.99.219.114:28888/qjny/report"; //直接跳转到数据决策系统
  32. };
  33. }
  34. document.getElementsByTagName("head")[0].appendChild(scr); //将iframe标签嵌入到head中
  35. }
  36. doSubmit();
  37. </script>
  38. </head>
  39. <body>
  40. <!-- <p>请登录</p>
  41. <form id="login" name="login" method="POST" action="">
  42. <p>用户名:<input id="username" type="text" name="username" /></p>
  43. <p>密 码:<input id="password" type="password" name="password" /></p>
  44. <input type="button" value="登录" onClick="doSubmit()" />
  45. </form> -->
  46. </body>
  47. </html>