我有这个简单的形式:
<form id="commentForm" method="POST" action="api/comment">
<input type="text" name="name" title="Your name"/>
<textarea cols="40" rows="10" name="comment" title="Enter a comment">
</textarea>
<input type="submit" value="Post"/>
<input type="reset" value="Reset"/>
</form>
Run Code Online (Sandbox Code Playgroud)
我需要在发送到服务器之前添加两个POST参数:
var params = [
{
name: "url",
value: window.location.pathname
},
{
name: "time",
value: new Date().getTime()
}
];
Run Code Online (Sandbox Code Playgroud)
请不要修改表格.
我知道,出于安全原因,如果iframe属于不同的域,则javascript无法读取iframe的内容.这是有道理的,因为整个页面可能是一个iframe,在框架之外有窥探脚本.
问题是 - 在另一个方向有相同的限制吗?iframe(来自不同的域)中的javascript可以在其父窗口中读取和操作dom吗?
谢谢!