JavaScript
- 13 ответов
- 0 вопросов
11
Вклад в тег
$answer = shell_exec("./ffmeg -param1 -param2");document.addEventListener('keydown', function(e){
KEY = ["t", "e", "s", "t"];
this.INPUT = this.INPUT || [];
this.INPUT.push(e.key);
if (this.INPUT.some((e, i) => KEY[i] != e))
this.INPUT = [this.INPUT.pop()];
else if (this.INPUT.length == KEY.length){
console.log("Congratulations!");
this.INPUT = [];
}
}) <html>
<head>
<title>Document</title>
</head>
<body>
<form action="b.html" method="GET">
<input type="text" name="variable1">
<input type="text" name="variable2">
<input type="submit">
</form>
</body>
</html><html>
<head>
<title>Document</title>
</head>
<body>
<script type="text/javascript">
function getGETParameters(paramStr){
return Object.fromEntries(paramStr.split('&').map(e => decodeURI(e).split('=')));
}
console.log(getGETParameters(window.location.search.substr(1)));
</script>
</body>
</html><html>
<head>
<title>Document</title>
</head>
<body>
<script type="text/javascript">
function getGETParameters(paramStr){
return Object.fromEntries(paramStr.split('&').map(e => decodeURI(e).split('=')));
}
let variables = getGETParameters(window.location.search.substr(1));
console.log(variables["variable1"]); // эта строка выведет в консоль то, что Вы вводили в первый input
</script>
</body>
</html> <form target="_blank" method="POST" action="../index.php">
<input type="radio" name="paymentType" value="PC">
<input type="radio" name="paymentType" value="AC">
<input type="radio" name="paymentType" value="MC">
</form>if (isset($_POST['paymentType'])){
if ($_POST['paymentType'] === 'PC')
header('Location: ../page/sds/3')
// ...
}это все понятно но мне нужно изменить форму до её отправки!!!
Тоесть в зависимости от выбранного radio форма будет уходить на другой сайт
<html>
<head>
<title>Document</title>
</head>
<body>
<form target="_blank" method="POST" action="../index.php" name="form">
<input type="radio" name="paymentType" value="PC">
<input type="radio" name="paymentType" value="AC">
<input type="radio" name="paymentType" value="MC">
</form>
<script type="text/javascript">
document.form.onchange = () => {
switch ((new FormData(document.form)).get('paymentType')){
case 'PC':
document.form.action = '/page/sds/3';
break;
case 'AC':
document.form.action = '/page/sds/4';
break;
case 'MC':
document.form.action = '/page/sds/5';
break;
}
}
</script>
</body>
</html>