با سلام
می خواستم بدونم که چه طور میشه که داخل onclick در submit کدی نوشت که به یک صفحه دیگر لینک شویم ؟؟؟؟
با سلام
می خواستم بدونم که چه طور میشه که داخل onclick در submit کدی نوشت که به یک صفحه دیگر لینک شویم ؟؟؟؟
کد HTML:<form action="test.php" method="get"> <input name="name" type="text" /> <input name="" type="submit" value="send" /> </form>
سلام.
می تونید بدین شکل عمل کنید:
<html>
<head>
<script language="JavaScript">
function onSubmitForm(form) {
//modify the form's action on demand...
form.action = "http://google.com";
return true;
}
</script>
</head>
<body>
<form action="whatever.aspx" method="get" onsubmit="return onSubmitForm(this);">
<input name="myField" type="text" />
<input name="submit" type="submit" value="submit" />
</form>
</body>
</html>
اونجاییکه در کد فوق نوشته ام modify form's action میتونید بر اساس شرایط مورد نظر، action فرم رو تغییر بدید تا اطلاعات به صفحه مورد نظر شما Submit بشه.
موفق باشید.
به این صورت هم می توانید action فرم را به صورت window.open باز کنید:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<title>Untitled Document</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<script>
function send()
{
window.open("","win","width=500,height=300,toolbar =0");
}
</script>
</head>
<body>
<form name=form1 method=post action=action.php target=win>
<input name="txt" type="text">
<input name="Submit" type=submit onClick='send();' value='Submit'>
</form>
</body>
</html>