<!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="en" lang="en"> <head> <title>Test</title> <meta http-equiv="content-type" content="text/html; charset=utf-8" /> <style> #div1 { width: 100px; height: 30px; margin: 2px; cursor: pointer; color: white; text-align: center; line-height: 2; background-color: #00B640; } #div2 { width: 100px; height: 30px; margin: 2px; cursor: pointer; color: white; text-align: center; line-height: 2; background-color: #FF8500; } #div3 { width: 100px; height: 30px; margin: 2px; cursor: pointer; color: white; text-align: center; line-height: 2; background-color: #0073DC; } </style> <script type="text/javascript"> function swapSibling(current) { getLastElement(function(last){ current.parentNode.replaceChild(current, last); current.parentNode.insertBefore(last, current); }); } function getLastElement(success){ var container = document.getElementById('container'); var last = container.children.length-1; typeof success === 'function' && success(container.children[last]); return container.children[last]; } </script> </head> <body> <div id="container"> <div id="div1" onclick="swapSibling(document.getElementById('div1'))">1</div> <div id="div2" onclick="swapSibling(document.getElementById('div2'))">2</div> <div id="div3" onclick="swapSibling(document.getElementById('div3'))">3</div> </div> </body> </html>
Saludos amigos en esta oportunidad estableceremos conexion con postgre, para realizar la insercion de datos, primero que todo crearemos las variables de la conexion: String driver = "org.postgresql.Driver" ; String ruta = "jdbc:postgresql://localhost:5432/ nombre de la bd " ; String user = "postgres" ; String password = " clave "; Importante: El driver de Postgre para Java lo puedes descargar desde aqui: Driver PostgreSQL para explicar algo que es fundamental sobre la base de datos Ejemplo es que esta tiene tres (3) campos que son: codusuarios : de tipo biginteger serial (lo quiere decir que es un campo auto incremento en postgre). nombre : de tipo text. identificacion : de tipo text . Ahora seguimos con el codigo para insertar datos. Esta es la funcion correspondiente: public void GuardarUsuario ( String nombre, String identificacion){ / / Insertar datos a la bd: try{ Class.forName( d
Comentarios
Publicar un comentario