function Reporter(tn) { var test_cod=tn.innerHTML; window.opener.document.forms["test"].elements["test_cod"].value=test_cod; }
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="fr"> <head> <title>Popup</title> <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" /> <script language="javascript"> function Reporter(l) { var cencpt_cod=l.options[l.options.selectedIndex].value; window.opener.document.forms["test"].elements["test_cod"].value=test_cod; window.close(); } </script> </head> <?php include ("connect.php"); ?> <form name='report'> <select onChange="Reporter(this)"> <?php if($cod==""){ echo('<option value="'.'">'.'Choisir'.'</option>'); } else { echo('<option value="'.'">'.'</option>');} $SQL = "SELECT * FROM TEST"; $res = mysql_query($SQL); while($val=mysql_fetch_array($res)) { echo "<option>".$val["COD"]. ' - '.$val["LIB"]."</option>\n"; } ?> </select> </form> <!-- [javascript:window.close() Fermer la pop-up] (lien pour fermer la pop-up mauellement) --> <?php include ("disconnect.php"); ?> </html>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="fr"> <head> <title>Popup</title> <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" /> <script language="javascript"> function Reporter(l) { var cencpt_cod=l.options[l.options.selectedIndex].value; window.opener.document.forms["test"].elements["test_cod"].value=test_cod; window.close(); } </script> </head> <?php include ("connect.php"); ?> <form name='report'> <?php $SQL = "SELECT COD,LIB FROM TEST"; $res = mysql_query($SQL); while($row=mysql_fetch_row($res)) { $Cod = $row[0]; $Lib = $row[1]; ?> <tr> <td>[javascript:Reporter(this) <?php echo $Cod ?>]</td> <td><?php echo $Lib ?></td> </tr> <?php } ?> </form> <?php include ("disconnect.php"); ?>
function Reporter(l) { var cencpt_cod=l.options[l.options.selectedIndex].value; window.opener.document.forms["test"].elements["test_cod"].value=test_cod; window.close(); }
Vous n’avez pas trouvé la réponse que vous recherchez ?
Posez votre questionfunction Reporter(element) { var test_cod=element.options[element.options.selectedIndex].value; window.opener.document.forms["test"].elements["test_cod"].value=test_cod; window.close(); }
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="fr"> <head> <title>TEST</title> <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" /> <meta http-equiv="Content-Language" content="fr" /> <script type="text/javascript" src="open_popup_test.js"></script> </head> <?php mysql_connect(localhost, root, root) or die('Connexion au serveur impossible ! '); mysql_select_db(test2) or die('Connexion impossible à la base '); ?> <form name='test'> TEST: [javascript:open_popup_test() Ouverture popup] <?php mysql_close(); ?> </html>
function open_popup_test() { window.open("popup_test.php", "TEST", "toolbar=yes, status=yes, scrollbars=yes, resizable=no, width=300, height=300"); }
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="fr"> <head> <title>Popup</title> <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" /> <script language="javascript"> function Reporter(element) { var test_cod=element.[element.selectedIndex].value; window.opener.document.forms["test"].elements["test_cod"].value=test_cod; window.close(); } </script> </head> <?php mysql_connect(localhost, root, root) or die('Connexion au serveur impossible ! '); mysql_select_db(test2) or die('Connexion impossible à la base '); ?> <form name='report'> <?php $SQL = "SELECT COD,LIB FROM TEST"; $res = mysql_query($SQL); while($row=mysql_fetch_row($res)) { $cod = $row[0]; $lib = $row[1]; ?> <?php echo $cod ?>, <?php echo $lib ?> <?php } ?> </form> <?php mysql_close(); ?> </html>
SET SQL_MODE="NO_AUTO_VALUE_ON_ZERO"; CREATE TABLE IF NOT EXISTS `test` ( `ID` int(11) NOT NULL AUTO_INCREMENT, `COD` varchar(5) COLLATE utf8_unicode_ci NOT NULL, `LIB` varchar(40) COLLATE utf8_unicode_ci DEFAULT NULL, PRIMARY KEY (`ID`), UNIQUE KEY `ID` (`ID`) ) ENGINE=MyISAM DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci AUTO_INCREMENT=5 ; -- Contenu de la table `test` INSERT INTO `test` (`ID`, `COD`, `LIB`) VALUES (1, '1111', 'TEST1'), (2, '2222', 'TEST2'), (3, '3333', 'TEST3'), (4, '4444', 'TEST4');
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="fr"> <head> <title>Popup</title> <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" /> <script language="javascript"> function Reporter(element) { var test_cod=element.options[element.options.selectedIndex].value; window.opener.document.forms["test"].elements["test_cod"].value=test_cod; window.close(); } </script> </head> <?php mysql_connect(localhost, root, root) or die('Connexion au serveur impossible ! '); mysql_select_db(test2) or die('Connexion impossible à la base '); ?> <form name='report'> <select onChange="Reporter(this)"> <?php if($cod==""){ echo('<option value="'.'">'.'Choisir'.'</option>'); } else { echo('<option value="'.'">'.'</option>');} $SQL = "SELECT COD,LIB FROM TEST"; $res = mysql_query($SQL); while($val=mysql_fetch_array($res)) { echo "<option>".$val["COD"]. ' - '.$val["LIB"]."</option>\n"; } ?> </select> </form> <?php mysql_close(); ?> </html>
var test_cod=element.options[element.options.selectedIndex].value;
var test_cod=document.getElementsByTagName("table")[0];
313100000001
<?php echo $cod ?>
function Reporter() { var test_cod=this.innerHTML; window.opener.document.forms["test"].elements["test_cod"].value=test_cod; }
function Reporter(tn) { var test_cod=tn.innerHTML; window.opener.document.forms["test"].elements["test_cod"].value=test_cod; }
<?php echo $cod ?>