Ouvrir un popup de formulaire apres clic sur un lien href
Bonjour la communauté,
Je souhaiterai en cliquant sur "ouverture formulaire" afficher mon formulaire (form.html) sur ma page (test2.html) sous forme d'un popup.
Actuellement le formulaire s'ouvre sur une autre page.
Pourriez-vous svp m'aider?
Merci
--> form.test
Code:
1 2 3 4 5 6 7 8 9 10 11 12 13 14
| <!DOCTYPE html>
<html lang="en" dir="ltr">
<head>
<meta charset="utf-8">
<title></title>
</head>
<body>
<form class="" id="formtest"action="index.html" method="post">
<label for="test">votre nom</label>
<input type="text" name="" id="test" value="">
<input type="submit" name="" value="submit">
</form>
</body>
</html> |
---> test2.html
Code:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16
|
<!DOCTYPE html>
<html lang="fr" dir="ltr">
<head>
<meta charset="utf-8">
<title>test2</title>
</head>
<body>
<ul>
<li><a id="testhref" href="form.html"> Ouverture formulaire</a></li>
</ul>
<script type="text/javascript" src="pop.js"></script>
</body>
</html> |
---> pop.js
Code:
1 2 3 4
|
document.getElementById("testhref").addEventListener('click', function() {
document.getElementById("formtest").style.display='visible';
}); |