Error al ejecutar función javascript desde función aspx
Publicado por Fernanda (22 intervenciones) el 15/12/2014 14:50:52
Hola a todos
tengo el siguiente código .... cuando lo ejecuto me da error "Error en tiempo de ejecución de JavaScript: No se puede obtener la propiedad 'innerHTML' de referencia nula o sin definir".
Alguien sabe porque da ese error??
PRUEBA.ASPX.VB
Private Sub genera_datos()
Dim script1 As String
script1 = "<script>incluircontrol()</script>"
ScriptManager.RegisterStartupScript(Me, [GetType](), "prueba", script1, False)
end Sub
PRUEBA.ASPX
function incluircontrol() {
var html;
html = "<table><tr><td><td>PRUEBA JAVASCRIPT</tr></table>"
document.getElementById("pnlDinamico").innerHTML += html;
}
<asp:MultiView ID="MultiView1" runat="server" ActiveViewIndex="0" >
<asp:View ID="Tab4" runat="server">
<table cellpadding="0" cellspacing="0">
<tr><td>
<div id="pnlDinamico"> </div>
</td></tr>
</table>
</asp:View>
</asp:MultiView>
tengo el siguiente código .... cuando lo ejecuto me da error "Error en tiempo de ejecución de JavaScript: No se puede obtener la propiedad 'innerHTML' de referencia nula o sin definir".
Alguien sabe porque da ese error??
PRUEBA.ASPX.VB
Private Sub genera_datos()
Dim script1 As String
script1 = "<script>incluircontrol()</script>"
ScriptManager.RegisterStartupScript(Me, [GetType](), "prueba", script1, False)
end Sub
PRUEBA.ASPX
function incluircontrol() {
var html;
html = "<table><tr><td><td>PRUEBA JAVASCRIPT</tr></table>"
document.getElementById("pnlDinamico").innerHTML += html;
}
<asp:MultiView ID="MultiView1" runat="server" ActiveViewIndex="0" >
<asp:View ID="Tab4" runat="server">
<table cellpadding="0" cellspacing="0">
<tr><td>
<div id="pnlDinamico"> </div>
</td></tr>
</table>
</asp:View>
</asp:MultiView>
Valora esta pregunta


0