C# と VB.NET の質問掲示板

ASP.NET、C++/CLI、Java 何でもどうぞ

ログ内検索
  • キーワードを複数指定する場合は 半角スペース で区切ってください。
  • 検索条件は、(AND)=[A かつ B] (OR)=[A または B] となっています。
  • [返信]をクリックすると返信ページへ移動します。
キーワード/ 検索条件 /
検索範囲/ 強調表示/ ON (自動リンクOFF)
結果表示件数/ 記事No検索/ ON
大文字と小文字を区別する

No.11550 の関連記事表示

<< 0 >>
■11550  FramesetのonloadでデータをPOSTで送信
□投稿者/ たろ -(2007/12/17(Mon) 20:10:44)

    分類:[.NET 全般] 

    環境は、visualstudio2005でc#を使っております。

    Framesetのonloadでデータをpost送信しているのですが、
    IE5.0の場合だけ、テキストやinputのhiddenの値を取得する部分で「オブジェクトが存在しない」と
    エラーになってしまいます。

    IE5.5以降では問題なく動作しているのですが、IE5.0では、FrameSetタグとformタグの併用は駄目とかあるんでしょうか?

    <ソース>
    ※document.Sendtest.REQ_TEST1.valueが存在しないといわれる。。

    <script language = "javascript">

       function LoadForm()
       {
    //パラメータの設定
    document.Sendtest.REQ_TEST1.value = document.all["test1Txt"].value;
    //データ送信
    document.Sendtest.target = "testframe1";
    document.Sendtest.action = "test1.aspx";
    document.Sendtest.submit();

    //パラメータの設定
    document.Sendtest.REQ_TEST2.value = document.all["test2Txt"].value;
    //データ送信
    document.Sendtest.target = "testframe2";
    document.Sendtest.action = "test2.aspx";
    document.Sendtest.submit();
    }

    </script>



    <frameset id="EditReportFrameset" cols="32%,*" border="1" frameSpacing="0" frameBorder="1" onLoad="LoadForm()">
    <frame id="testframe1" name="testframe1" scrolling="auto" noresize>
    <frame id="testframe2" name="testframe2" scrolling="no" noresize>
    </frameset>
    <form id="dispform" name="dispform" method="post" runat="server">
    <div style="VISIBILITY: hidden; WIDTH: 0px; HEIGHT: 0px">
    <asp:textbox id="test1Txt" runat="server" Enabled="False" Height="0px" Width="0px"></asp:textbox>
    <asp:textbox id="test2Txt" runat="server" Enabled="False" Height="0px" Width="0px"></asp:textbox>
    </div>
    </form>
    <form id="Sendtest" name="Sendtest" method="post">
    <input id="REQ_TEST1" type="hidden" name="REQ_TEST1">
    <input id="REQ_TEST2" type="hidden" name="REQ_TEST2">
    </form>
親記事 /過去ログ25より / 関連記事表示
削除チェック/

■11565  Re[1]: FramesetのonloadでデータをPOSTで送信
□投稿者/ mあ@反省中 -(2007/12/18(Tue) 01:41:38)
    No11550 (たろ さん) に返信
    > Framesetのonloadでデータをpost送信しているのですが、
    > IE5.0の場合だけ、テキストやinputのhiddenの値を取得する部分で「オブジェクトが存在しない」と
    > エラーになってしまいます。

    <frameset> を document.write() して、<form>はちゃんと<body>タグで囲ったらどうです?
記事No.11550 のレス /過去ログ25より / 関連記事表示
削除チェック/

■11576  Re[2]: FramesetのonloadでデータをPOSTで送信
□投稿者/ たろ -(2007/12/18(Tue) 09:46:36)
    2007/12/18(Tue) 09:48:54 編集(投稿者)

    返信ありがとうございます。

    <frameset>をdocument.write()にしてみましたが、やはり同じエラーが出てしまいます。
    下記にソースを記載しましたが、こんな感じですよね?

    <ソース>
    ※やはりdocument.Sendtest.REQ_TEST1.valueが存在しないといわれる。。

    <html>
    <head>
    <script language = "javascript">

    document.open();
    document.write("<frameset id='EditReportFrameset' cols='32%,*' border='1' frameSpacing='0' frameBorder='1' onLoad='LoadForm()'>");
    document.write("<frame id='testframe1' name='testframe1' scrolling='auto' noresize>");
    document.write("<frame id='testframe2' name='testframe2' scrolling='no' noresize>");
    document.write("</frameset>");
    document.close();

    function LoadForm()
    {
    //パラメータの設定
    document.Sendtest.REQ_TEST1.value = document.all["test1Txt"].value;
    //データ送信
    document.Sendtest.target = "testframe1";
    document.Sendtest.action = "test1.aspx";
    document.Sendtest.submit();

    //パラメータの設定
    document.Sendtest.REQ_TEST2.value = document.all["test2Txt"].value;
    //データ送信
    document.Sendtest.target = "testframe2";
    document.Sendtest.action = "test2.aspx";
    document.Sendtest.submit();
    }

    </script>

    </head>


    <body>
    <form id="dispform" name="dispform" method="post" runat="server">
    <div style="VISIBILITY: hidden; WIDTH: 0px; HEIGHT: 0px">
    <asp:textbox id="test1Txt" runat="server" Enabled="False" Height="0px" Width="0px"></asp:textbox>
    <asp:textbox id="test2Txt" runat="server" Enabled="False" Height="0px" Width="0px"></asp:textbox>
    </div>
    </form>
    <form id="Sendtest" name="Sendtest" method="post">
    <input id="REQ_TEST1" type="hidden" name="REQ_TEST1">
    <input id="REQ_TEST2" type="hidden" name="REQ_TEST2">
    </form>
    </body>
    </html>
記事No.11550 のレス /過去ログ25より / 関連記事表示
削除チェック/

■11586  Re[3]: FramesetのonloadでデータをPOSTで送信
□投稿者/ mあ@反省中 -(2007/12/18(Tue) 12:08:41)

    <script language = "javascript">

    function LoadForm()
    {

    alert(document.forms.length);

    var fm = document.createElement("form");

    var h1 = document.createElement("input");
    h1.type = "hidden";
    h1.name = "REQ_TEST1";
    h1.id = "REQ_TEST1";
    var h2 = document.createElement("input");
    h2.type = "hidden";
    h2.name = "REQ_TEST2";
    h2.id = "REQ_TEST2";

    fm.appendChild(h1);
    fm.appendChild(h2);

    document.body.appendChild(fm);

    //<form id="Sendtest" name="Sendtest" method="post">
    // <input id="REQ_TEST1" type="hidden" name="REQ_TEST1">
    // <input id="REQ_TEST2" type="hidden" name="REQ_TEST2">
    //</form>

    document.forms[0].REQ_TEST1.value = "OK-NG";
    document.forms[0].target = "testframe1";
    document.forms[0].action = "http://www.yahoo.co.jp";
    document.forms[0].submit();

    document.forms[0].REQ_TEST1.value = "OK-OK";
    document.forms[0].target = "testframe2";
    document.forms[0].action = "http://www.infoseek.co.jp";
    document.forms[0].submit();

    }

    </script>

    <frameset id="EditReportFrameset" cols="32%,*" border="1" frameSpacing="0" frameBorder="1" onLoad="LoadForm()">
    <frame id="testframe1" name="testframe1" scrolling="auto" noresize>
    <frame id="testframe2" name="testframe2" scrolling="no" noresize>
    </frameset>




    ASP タグのとこはわかんね。

    あとは任せます。

記事No.11550 のレス /過去ログ25より / 関連記事表示
削除チェック/

■11603  Re[4]: FramesetのonloadでデータをPOSTで送信
□投稿者/ たろ -(2007/12/18(Tue) 18:46:06)
    返信ありがとうございます。

    うまくいきました!

    IE5.0〜IE6.0まで問題なく動作しました。
    Onload時にformを作成する発想はすばらしいです!

    いつもありがとうございます!


記事No.11550 のレス / END /過去ログ25より / 関連記事表示
削除チェック/



<< 0 >>

パスワード/

- Child Tree -