Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

325
Vistas
SyntaxError no detectado: identificador inesperado en html en javascript

Estaba tratando de determinar el tamaño de este rectángulo por parte del usuario:

 <svg width=parseFloat(Rectangle1.width) height=parseFloat(Rectangle1.height)> <rect width=parseInt(input1int) height=parseInt(input2int) style="fill:rgb(0,0,255);stroke-width:3;stroke:rgb(0,0,0)" /> </svg>

con este código:

 class Rectangle{ constructor(height, width){ this.height = height; this.width = width; }; function createRectangle(this.height,this.width){ var input1 = document.getElementbyId("1stinput").value; var input2 = document.getElementbyId("#2ndinput").value; var input1int = parseFloat(input1); var input2int = parseFloat(input2); var Rectangle1 = new Rectangle(this.height=input1int, this.width=input2int);}; };

pero tengo un total de cinco errores para mí:

 Uncaught SyntaxError: Unexpected identifier index.html:25 Error: <svg> attribute width: Expected length, "parseFloat(Recta…". index.html:25 Error: <svg> attribute height: Expected length, "parseFloat(Recta…". index.html:26 Error: <rect> attribute width: Expected length, "parseInt(input1i…". index.html:26 Error: <rect> attribute height: Expected length, "parseInt(input2i…".

No sé lo que significan, así que una vez más solicito su apoyo de codificación financiera .

about 4 years ago · Juan Pablo Isaza
1 Respuestas
Responde la pregunta

0

Eso no es html válido. Si desea establecer el width de un elemento dinámicamente. Debe configurarlo en JavaScript. Me gusta

 document.querySelector("svg").setAttribute('width', parseFloat(Rectangle1.width))
about 4 years ago · Juan Pablo Isaza Denunciar
Responde la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda