以post方式向iframe传值

引用

get 对中文会乱码,所以想用post
以post方式向iframe传值示例如下:
test.html
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML>
<HEAD>
<TITLE> test </TITLE>
</HEAD>

<BODY onload="document.getElementByIdx('myform').submit()">

<IFRAME NAME="ABC" STYLE="width:400;height:200"></IFRAME>

<FORM id="myform" METHOD=POST ACTION="test.jsp" TARGET="ABC">
    <INPUT TYPE="hidden" NAME="A1" value="guoguo">
</FORM>

</BODY>
</HTML>

test.jsp
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Strict//EN" "http://www.w3.org/TR/html4/strict.dtd">
<%@ page contentType="text/html; charset=UTF-8" %>
<html>
    <head>
        <title>test </title>
    </head>
    <body>
        <% String a1=request.getParameter("A1");%>
        a1=<%=a1 %>
    </body>
</html>

你可能感兴趣的:(iframe)