Este es mi archivo js:
Código:
Y este es mi archivo html donde están los inputs:idioma = document.getElementsByTagName("html")[0].getAttribute("lang"); descripcion = document.getElementById('edit-field-pdf-informacion-obra-und-0-description'); cartel = document.getElementById('edit-field-pdf-cartel-obra-und-0-description'); if(idioma=="es"){ descripcion.value="Description"; cartel.value="Cartel"; } else if(idioma=="en"){ descripcion.value="Description"; cartel.value="Cartel"; } else{ descripcion.value="Informations"; cartel.value="Affiche"; }
Código:
Aparentemente debería cambiar los valores pero no lo hace. <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html lang="es" xmlns="http://www.w3.org/1999/xhtml"> <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <title>Documento sin título</title> <script src="descripcion-cartel.js" type="text/javascript"></script> </head> <input type="text" id="edit-field-pdf-informacion-obra-und-0-description" name="field_pdf_informacion_obra[und][0][description]" value="Des1" size="60" maxlength="128" class="form-text"> <input type="text" id="edit-field-pdf-cartel-obra-und-0-description" name="field_pdf_cartel_obra[und][0][description]" value="Car1" size="60" maxlength="128" class="form-text"> <body> </body> </html>
También he probado con setAttribute("value","valor");
Pero nada. En el firebug del firefox siempre me dice que estan null.
Alguen me ayuda?
Gracias de antemano!!