-3

サイトに自動的にログインできるようにしたい。そのために、そのサイトのログイン ページのコピーを保存します。次に、このコピーにパスワードとユーザー名を事前に入力します。このページにログインボタンがあります。通常、ユーザー名とパスワードを入力した後、このボタンをクリックして次のページに移動する必要があります。しかし、私はこれを自動的に行いたいです。ソースコードの関連部分は次のとおりです。

<html>
<head>
<meta http-equiv="imagetoolbar" content="no">
<link rel="SHORTCUT ICON" href="/favicon.ico">
<SCRIPT>var main=window;</SCRIPT><SCRIPT LANGUAGE="JavaScript" src="http://localhost/_common/cjmaker.js"></SCRIPT>

<title>Login Page</title>
<SCRIPT LANGUAGE="JavaScript">  function openNewBrowserWindow() { newWindow = window.open("http://localhost/_common/lvl5/dologin.html", "subWind", "statusbar,menubar,resizable"); newWindow.focus(); }  function getUsername() { return document.getElementById("nameInput").value; }   function getPassword() { return document.getElementById("pass").value; }   function setFocus() { document.getElementById('nameInput').value == "" ? document.getElementById("nameInput").focus() : document.getElementById("pass").focus(); } </SCRIPT><style type="text/css">
<!--
td {  font-family: Arial, Helvetica, sans-serif; font-size: 18px; }
body { font-size:12px; vertical-align:baseline; padding:0; margin:0px; height:1px; font-family:arial;color:#A8A8A8; background-color:#000000;}

.normText { color:#A8A8A8;  }
.normTextBold  { font-weight:bold; }
.bigText  { font-size: 30px; font-weight: bold }
.bigRedText  { font-size: 30px; color: #FF0000; font-weight: bold }
.legalTextArea { font-size:10px; color:A8A8A8; background-color:000000}
.smallText { font-size:12px }
-->
</style></head>
<body style="height:100%" SCROLL="NO" onload="setFocus();document.getElementById('loginForm').submit();">


<table border=0 cellpadding=0 cellspacing=0 style="width:100%; height:100%">
<tr height="27px" style="max-height:27px;"> 
    <td valign="bottom" width="14" height="27px"> <img width="14"  height="27" src="http://localhost/_common/lvl5/skin/graphics/login/sectionb5.gif"></td>
    <td valign="bottom" width="13" height="27px"><img width="13"  height="27" src="http://localhost/_common/lvl5/skin/graphics/login/sectionb6.gif"></td>
    <td valign="bottom" width="100%" style="position: relative; background-image: url('http://localhost/_common/lvl5/skin/graphics/login/sectionb7.gif'); background-repeat: repeat-x;"  height="27px"></td>
    <td valign="bottom" width="14" height="27px"> <img width="14"  height="27" src="http://localhost/_common/lvl5/skin/graphics/login/sectionb8.gif"></td>
  </tr>
   <tr> 
    <td width="10" style="background-image: url('http://localhost/_common/lvl5/skin/graphics/login/sectionc5.gif'); background-repeat: repeat-y;"> 
    </td>
    <td COLSPAN="2"> 
<form id="loginForm" method="post" name='loginForm' action="http://localhost/_common/servlet/lvl5/login?language=en" onsubmit="document.getElementById('pass').value = CJMaker.makeString(document.getElementById('pass').value);" ></form>
        <div align="center"><img src="/logo.gif" width="536"></div>
        <table border="0" align="center" name="logintable" >
          <tr>
             <td colspan="3">&nbsp;</td></tr><tr><td align="center" colspan=3 height="100"><span class="normText"><span class="bigRedText">Dealer Copy</span></span><br><span class="normText"><span class="normRedText">This software is only licensed for internal use by a Dealer for Automated Logic Corporation</span><BR><SPAN class="smallText">Serial Number&nbsp;(&nbsp;W200500023&nbsp;)</SPAN></SPAN></span></td>
          </tr><tr><td colspan="3">&nbsp;</td></tr>
          <tr> 
            <td colspan=3 align="center">Please log in</td>
          </tr>
          <tr> 
            <td width="50%" align="right"> 
              <div align="right" style="margin-right:10px;">Name:</div>
            </td>
            <td> 
              <div align="left"> 
                <input id="nameInput" type="text" value="Administrator" name="name" size="25" maxlength="80" tabindex="1" style="width:175px;">
              <script>
                 if(document.getElementById('nameInput').value == '')
                 {
                   document.getElementById('nameInput').focus();
                 }
              </script>
              </div>
            </td>
            <TD rowspan="2" width="50%" align="left"> 
              <div align="left" style="margin-left:10px;"> 
                <input type="submit" id="submit" name="Submit" style="background-color:#A8A8A8" value="Log in" tabindex="2">&nbsp;&nbsp;
              </div>
            </TD>
          </tr>
          <tr> 
            <td> 
              <div align="right" style="margin-right:10px;">Password:</div>
            </td>
            <td> 
              <div align="left"> 
                <input type="password" value="" id="pass" name="pass"  autocomplete="off" size="25" maxlength="80" tabindex="1" style="width:175px;  ">
              <script>
                 if(document.getElementById('nameInput').value != '')
                 {
                   document.getElementById('pass').focus();
                 }
              </script>
              </div>
            </td>
            </tr>
       </table>
             </td>
    <td valign="top" width="14" style="background-image: url('http://localhost/_common/lvl5/skin/graphics/login/sectionc8.gif'); background-repeat: repeat-y"> 
      <span id="actionVbar" style="position:relative; width=100%; height=100%"></span> 
    </td>
  </tr>
  <tr height="14px"  style="max-height:14px"> 
    <td  valign="top"><img width="14" height="14" src="http://localhost/_common/lvl5/skin/graphics/login/sectiond5.gif"></td>
    <td  COLSPAN="2" valign="top" style="background-image: url('http://localhost/_common/lvl5/skin/graphics/login/sectiond6.gif'); background-repeat: repeat-x; line-height: 14px;" height="14px">&nbsp;</td>
    <td  valign="top" height="14px"><img  width="14" height="14" src="http://localhost/_common/lvl5/skin/graphics/login/sectiond8.gif"></td>
  </tr>
</table><div id="imagecachediv" style="position:absolute; z-index:-10; top:0px; left:0px; visibility:hidden" >
   <IMG SRC="http://localhost/_common/lvl5/skin/graphics/actions/acbutton_down_middle.gif">
   <IMG SRC="http://localhost/_common/lvl5/skin/graphics/actions/acbutton_down_left.gif">
   <IMG SRC="http://localhost/_common/lvl5/skin/graphics/actions/acbutton_down_right.gif">
   <IMG SRC="http://localhost/_common/lvl5/skin/graphics/actions/acbutton_up_middle.gif">
   <IMG SRC="http://localhost/_common/lvl5/skin/graphics/actions/acbutton_up_left.gif">
   <IMG SRC="http://localhost/_common/lvl5/skin/graphics/actions/acbutton_up_right.gif">
   <IMG SRC="http://localhost/_common/lvl5/skin/graphics/actions/actionbutton_dn_middle.gif">
   <IMG SRC="http://localhost/_common/lvl5/skin/graphics/actions/actionbutton_dn_left.gif">
   <IMG SRC="http://localhost/_common/lvl5/skin/graphics/actions/actionbutton_dn_right.gif">
   <IMG SRC="http://localhost/_common/lvl5/skin/graphics/actions/actionbutton_up_left.gif">
   <IMG SRC="http://localhost/_common/lvl5/skin/graphics/actions/actionbutton_up_middle.gif">
   <IMG SRC="http://localhost/_common/lvl5/skin/graphics/actions/actionbutton_up_right.gif">
   <IMG SRC="http://localhost/_common/lvl5/skin/graphics/facets/facettab_down_middle.gif">
   <IMG SRC="http://localhost/_common/lvl5/skin/graphics/facets/facettab_up_middle.gif">
   <IMG SRC="http://localhost/_common/lvl5/skin/graphics/buttons/textbutton_down_middle.gif">
   <IMG SRC="http://localhost/_common/lvl5/skin/graphics/buttons/textbutton_up_middle.gif">
   <IMG SRC="http://localhost/_common/lvl5/skin/graphics/properties/equip_templates/setpt_graphics/setpointtempindicator.gif">
   <IMG SRC="http://localhost/_common/lvl5/skin/graphics/properties/equip_templates/setpt_graphics/setpointheader.gif">
   <IMG SRC="http://localhost/_common/lvl5/skin/graphics/properties/equip_templates/setpt_graphics/setpointbody.gif">
   <IMG SRC="http://localhost/_common/lvl5/skin/graphics/properties/equip_templates/setpt_graphics/setpointfooter.gif">
   <IMG SRC="http://localhost/_common/lvl5/graphics/patterns/uphashes.gif">
   <IMG SRC="http://localhost/_common/lvl5/graphics/patterns/horiz.gif">
   <IMG SRC="http://localhost/_common/lvl5/graphics/patterns/leftdiagonal.gif">
   <IMG SRC="http://localhost/_common/lvl5/graphics/patterns/vert.gif">
   <IMG SRC="http://localhost/_common/lvl5/graphics/patterns/tickbackground.gif">
   <IMG SRC="http://localhost/_common/lvl5/graphics/patterns/squares.gif">

   <IMG SRC="http://localhost/_common/lvl5/graphics/main/de/scheduleticks_12.gif">
   <IMG SRC="http://localhost/_common/lvl5/graphics/main/en/scheduleticks_12.gif">
   <IMG SRC="http://localhost/_common/lvl5/graphics/main/es/scheduleticks_12.gif">
   <IMG SRC="http://localhost/_common/lvl5/graphics/main/fr/scheduleticks_12.gif">
   <IMG SRC="http://localhost/_common/lvl5/graphics/main/fr_FR/scheduleticks_12.gif">
   <IMG SRC="http://localhost/_common/lvl5/graphics/main/ko/scheduleticks_12.gif">
   <IMG SRC="http://localhost/_common/lvl5/graphics/main/ru/scheduleticks_12.gif">
   <IMG SRC="http://localhost/_common/lvl5/graphics/main/sv/scheduleticks_12.gif">
   <IMG SRC="http://localhost/_common/lvl5/graphics/main/th/scheduleticks_12.gif">
   <IMG SRC="http://localhost/_common/lvl5/graphics/main/vi/scheduleticks_12.gif">
   <IMG SRC="http://localhost/_common/lvl5/graphics/main/zh/scheduleticks_12.gif">
   <IMG SRC="http://localhost/_common/lvl5/graphics/main/zh_TW/scheduleticks_12.gif">
   <IMG SRC="http://localhost/_common/lvl5/graphics/main/de/scheduleticks_24.gif">
   <IMG SRC="http://localhost/_common/lvl5/graphics/main/en/scheduleticks_24.gif">
   <IMG SRC="http://localhost/_common/lvl5/graphics/main/es/scheduleticks_24.gif">
   <IMG SRC="http://localhost/_common/lvl5/graphics/main/fr/scheduleticks_24.gif">
   <IMG SRC="http://localhost/_common/lvl5/graphics/main/fr_FR/scheduleticks_24.gif">
   <IMG SRC="http://localhost/_common/lvl5/graphics/main/ko/scheduleticks_24.gif">
   <IMG SRC="http://localhost/_common/lvl5/graphics/main/ru/scheduleticks_24.gif">
   <IMG SRC="http://localhost/_common/lvl5/graphics/main/sv/scheduleticks_24.gif">
   <IMG SRC="http://localhost/_common/lvl5/graphics/main/th/scheduleticks_24.gif">
   <IMG SRC="http://localhost/_common/lvl5/graphics/main/vi/scheduleticks_24.gif">
   <IMG SRC="http://localhost/_common/lvl5/graphics/main/zh/scheduleticks_24.gif">
   <IMG SRC="http://localhost/_common/lvl5/graphics/main/zh_TW/scheduleticks_24.gif">

   <IMG SRC="http://localhost/_common/lvl5/graphics/main/de/schedulefooter_12.gif">
   <IMG SRC="http://localhost/_common/lvl5/graphics/main/en/schedulefooter_12.gif">
   <IMG SRC="http://localhost/_common/lvl5/graphics/main/es/schedulefooter_12.gif">
   <IMG SRC="http://localhost/_common/lvl5/graphics/main/fr/schedulefooter_12.gif">
   <IMG SRC="http://localhost/_common/lvl5/graphics/main/fr_FR/schedulefooter_12.gif">
   <IMG SRC="http://localhost/_common/lvl5/graphics/main/ko/schedulefooter_12.gif">
   <IMG SRC="http://localhost/_common/lvl5/graphics/main/ru/schedulefooter_12.gif">
   <IMG SRC="http://localhost/_common/lvl5/graphics/main/sv/schedulefooter_12.gif">
   <IMG SRC="http://localhost/_common/lvl5/graphics/main/th/schedulefooter_12.gif">
   <IMG SRC="http://localhost/_common/lvl5/graphics/main/vi/schedulefooter_12.gif">
   <IMG SRC="http://localhost/_common/lvl5/graphics/main/zh/schedulefooter_12.gif">
   <IMG SRC="http://localhost/_common/lvl5/graphics/main/zh_TW/schedulefooter_12.gif">
   <IMG SRC="http://localhost/_common/lvl5/graphics/main/de/schedulefooter_24.gif">
   <IMG SRC="http://localhost/_common/lvl5/graphics/main/en/schedulefooter_24.gif">
   <IMG SRC="http://localhost/_common/lvl5/graphics/main/es/schedulefooter_24.gif">
   <IMG SRC="http://localhost/_common/lvl5/graphics/main/fr/schedulefooter_24.gif">
   <IMG SRC="http://localhost/_common/lvl5/graphics/main/fr_FR/schedulefooter_24.gif">
   <IMG SRC="http://localhost/_common/lvl5/graphics/main/ko/schedulefooter_24.gif">
   <IMG SRC="http://localhost/_common/lvl5/graphics/main/ru/schedulefooter_24.gif">
   <IMG SRC="http://localhost/_common/lvl5/graphics/main/sv/schedulefooter_24.gif">
   <IMG SRC="http://localhost/_common/lvl5/graphics/main/th/schedulefooter_24.gif">
   <IMG SRC="http://localhost/_common/lvl5/graphics/main/vi/schedulefooter_24.gif">
   <IMG SRC="http://localhost/_common/lvl5/graphics/main/zh/schedulefooter_24.gif">
   <IMG SRC="http://localhost/_common/lvl5/graphics/main/zh_TW/schedulefooter_24.gif">

   <IMG SRC="http://localhost/_common/lvl5/graphics/main/trpixel.gif">
   <IMG SRC="http://localhost/_common/lvl5/skin/graphics/scrollbar/actscrollup.gif">
   <IMG SRC="http://localhost/_common/lvl5/skin/graphics/scrollbar/actscrolldown.gif">
   <IMG SRC="http://localhost/_common/lvl5/skin/graphics/scrollbar/actscrollleft.gif">
   <IMG SRC="http://localhost/_common/lvl5/skin/graphics/scrollbar/actscrollright.gif">

   <IMG SRC="http://localhost/_common/lvl5/skin/graphics/scrollbar/navscrollslider.gif">
   <IMG SRC="http://localhost/_common/lvl5/skin/graphics/scrollbar/navscrollhchan.gif">
   <IMG SRC="http://localhost/_common/lvl5/skin/graphics/scrollbar/navscrollvchan.gif">
   <IMG SRC="http://localhost/_common/lvl5/skin/graphics/scrollbar/navscrollup.gif">
   <IMG SRC="http://localhost/_common/lvl5/skin/graphics/scrollbar/navscrolldown.gif">
   <IMG SRC="http://localhost/_common/lvl5/skin/graphics/scrollbar/navscrollleft.gif">
   <IMG SRC="http://localhost/_common/lvl5/skin/graphics/scrollbar/navscrollright.gif">

   <IMG SRC="http://localhost/_common/lvl5/graphics/main/propscrollhchan.gif">
   <IMG SRC="http://localhost/_common/lvl5/graphics/main/propscrollvchan.gif">
</div>

</body>
</html>

私がやろうとしたのは、次のようなスクリプトを追加することでした

<SCRIPT LANGUAGE="JavaScript">document.getElementById('pass').value = CJMaker.makeString(document.getElementById('pass').value;</SCRIPT> 

「FORM」ブロックの「onsubmit」部分内にある同じコード。しかし、うまくいきませんでした。

これを手伝ってくれませんか?

前もって感謝します。

4

3 に答える 3

1

イベントにタグを追加document.getElementById('loginForm').submit();します。<body>onLoad

例えば、 <body onload="document.getElementById('loginForm').submit();">

于 2012-06-18T13:42:34.637 に答える
1

単純化することで問題を解決しました。

<html>

<title>Login Page</title>

<body onload="document.getElementById('loginForm').submit();">

<form id="loginForm" method="post" name='login' action="http://localhost/_common/servlet/lvl5/login?language=en" onsubmit="document.getElementById('pass').value = CJMaker.makeString(document.getElementById('pass').value);" >

<input id="nameInput" type="text" value="Administrator" name="name" size="25" maxlength="80" tabindex="1" style="width:175px;">

<input type="password" value="" id="pass" name="pass"  autocomplete="off" size="25" maxlength="80" tabindex="1" style="width:175px;  ">

</form> 

</body>
</html>
于 2012-06-19T08:23:26.093 に答える
0

このコードを呼び出す

$('#nameInput').val('user name');
$('#pass').val('password');
$('#loginForm').submit();

上記のコードを試して、自動的にログインしてください。私はそれがうまくいくと思います。

于 2012-06-18T13:17:33.323 に答える