求简单的JS代码 我想要点击2按钮 在页面上显示iframe 点击1按钮跳转 求帮助
<scripttype="text/javascript">functionsave(){document.form1.action="look.php";documen...
<script type="text/javascript">
function save()
{
document.form1.action="look.php";
document.form1.submit();
}
function send()
{
document.form1.action="b.php";
document.form1.submit();
}
</script>
</head>
<body>
<form name="form1" >
<input type="text" name="username" value="scott">
<input type="button" value="1" onclick="send();">
<input type="button" value="2" onclick="save();">
</form>
<iframe frameborder="0" scrolling="no" name="arr" src="look.php" ></iframe> 展开
function save()
{
document.form1.action="look.php";
document.form1.submit();
}
function send()
{
document.form1.action="b.php";
document.form1.submit();
}
</script>
</head>
<body>
<form name="form1" >
<input type="text" name="username" value="scott">
<input type="button" value="1" onclick="send();">
<input type="button" value="2" onclick="save();">
</form>
<iframe frameborder="0" scrolling="no" name="arr" src="look.php" ></iframe> 展开
展开全部
改动一下代码即可:
<script type="text/javascript">
function save()
{
document.getElementById('iframe1').src="look.php?username="+document.getElementById('f_username').value;
}
function send()
{
document.form1.action="b.php";
document.form1.submit();
}
</script>
</head>
<body>
<form name="form1" >
<input type="text" name="username" id="f_username" value="scott">
<input type="button" value="1" onclick="send();">
<input type="button" value="2" onclick="save();">
</form>
<iframe frameborder="0" scrolling="no" name="arr" id="iframe1" src="look.php" ></iframe>
纯手写代码,没有经过测试,楼主自己按照这个思路测试一下即可。
<script type="text/javascript">
function save()
{
document.getElementById('iframe1').src="look.php?username="+document.getElementById('f_username').value;
}
function send()
{
document.form1.action="b.php";
document.form1.submit();
}
</script>
</head>
<body>
<form name="form1" >
<input type="text" name="username" id="f_username" value="scott">
<input type="button" value="1" onclick="send();">
<input type="button" value="2" onclick="save();">
</form>
<iframe frameborder="0" scrolling="no" name="arr" id="iframe1" src="look.php" ></iframe>
纯手写代码,没有经过测试,楼主自己按照这个思路测试一下即可。
追问
太谢谢了 可以了
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询