0x800a138f - JavaScript runtime error: Cannot set src property that is undefined or null reference

yunhyejeong

Well-known member
Joined
Dec 5, 2021
Messages
135
Programming Experience
1-3
Hello
Please Help me.
0x800a138f - JavaScript runtime error: Cannot set src property that is undefined or null reference.

1.png

C#:
<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="FaceMonitor.aspx.cs" Inherits="GcIOTWeb.Face.FaceMonitor" %>

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">

<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
    <title></title>    
    <script type="text/javascript" src="../Common/js/default.js"></script>
    <script language="javascript" src="../Common/js/mainjs.js"></script>  

    <style type="text/css">
        .auto-style1
        {
            height: 1940px;
            width: 1900px;
        }
    </style>

    <script language="javascript" type="text/javascript">
        function ChangeMain(Pcode, Car, Cmt)
        {
            var Name = "document.Form1.img1101";
            var obj = eval(Name);

            obj.src = "image/Green.jpg";
            obj.alt = "";
        }

        function NewWin()
        {
            document.location.href = "FaceMonitor.aspx";
        }
    </script>
</head>
<body leftmargin="0" topmargin="0" ms_positioning="GridLayout">
    <form id="Form1" method="post" runat="server">
        <div style="overflow-x: hidden; overflow-y: scroll; text-align: center; width: 100%; height: 100%;">
            <table cellspacing="0" cellpadding="0" background="image/Face.jpg" border="0" class="auto-style1">
                <tr valign="top">
                    <td align="center">

                        <img id="img1101" name ="img1101" style="left: 32px; position: absolute; top: 118px" src="image/Red.jpg">
                 
                </td>
               </tr>
            </table>
            <iframe id="iTimerFrm" src="FaceMonitorTimer.aspx" frameborder="0" width="0" scrolling="no" height="0"></iframe>
        </div>
    </form>
</body>
</body>
</html>
C#:
<%@ Page Language="C#" AutoEventWireup="true" CodeFile="FaceMonitorTimer.aspx.cs" Inherits="FaceMonitorTimer" %>

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">

<html xmlns="http://www.w3.org/1999/xhtml" >
<head runat="server">
    <title></title>
    <meta name="GENERATOR" Content="Microsoft Visual Studio .NET 7.1">
        <meta name="CODE_LANGUAGE" Content="C#">
        <meta name="vs_defaultClientScript" content="JavaScript">
        <meta name="vs_targetSchema" content="http://schemas.microsoft.com/intellisense/ie5">
        <script language="javascript">
            function Init()
            {
                <%=m_javaVal%>
                window.setTimeout("MornitoringTimer()", 2000);
            }
                  
            function MornitoringTimer()
            {
                document.location.href = "FaceMonitorTimer.aspx";
            }
        </script>
    </HEAD>
    <body MS_POSITIONING="GridLayout" topmargin="0" leftmargin="0" rightmargin="0" bottommargin="0" onload="javascript:Init()">
        <form id="Form1" method="post" runat="server">
            <input type="hidden" runat="server" id="ChkFlag" NAME="ChkFlag">
            <input type="hidden" runat="server" id="txtImageSrc" NAME="txtImageSrc">
            <input type="hidden" runat="server" id="SessionFlag" name="SessionFlag" />         
    </form>
</body>
</html>
C#:
using System;
using System.Data;
using System.Configuration;
using System.Collections;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;
using System.Globalization;
using System.Text;
using System.Data.SqlClient;
using System.ComponentModel;
using System.Drawing;
using System.Web.SessionState;
using GcIOTWeb.App_Class;
using System.Resources;


public partial class FaceMonitorTimer : System.Web.UI.Page
{
    public aspxMaster aspx = new aspxMaster();

    public string m_javaVal;
    protected string sFileName;

    protected void Page_Load(object sender, EventArgs e)
    {
        sFileName = "/Face/FaceMonitorTimer.aspx.cs";
         

        if (!Page.IsPostBack)
        {
            CheckStatus();

            aspx.sqlString = new StringBuilder();
            aspx.sqlString.Append("SELECT No, Value FROM IOT.dbo.MornitoringFace");

            DataSet ds = aspx.db.ExecuteForQuery_DataSet(aspx.sqlString.ToString(), sFileName);

            int nCnt = ds.Tables[0].Rows.Count;

            int nnn = 0;
        }
    }

    private void CheckStatus()
    {
        m_javaVal += ChangeMain();      // 메인
    }

    private string ChangeMain()
    {
        string strTemp = "";

        try
        {
            aspx.sqlString = new StringBuilder();
            aspx.sqlString.Append("SELECT No, Value FROM IOT.dbo.MornitoringFace");
            DataSet ds = aspx.db.ExecuteForQuery_DataSet(aspx.sqlString.ToString(), sFileName);

            DataTable dt = ds.Tables[0];
                   
            if (dt.Rows.Count > 0)
            {
               strTemp += "parent.ChangeMain('3','2','1');";
            }

            dt.Clear();
        }
        catch (Exception ex)
        {
            return null;
        }

        return strTemp;
    }  
 
}
 
Last edited:

jmcilhinney

C# Forum Moderator
Staff member
Joined
Apr 23, 2011
Messages
4,466
Location
Sydney, Australia
Programming Experience
10+
Why would that error message be a surprise when your Watch window is telling you that Name is undefined? If you have a question is should be about line 23, not 26. Maybe you could take the time and make the effort to provide a FULL and CLEAR explanation of the problem. What exactly is that code supposed to be doing and why do you think it work?
 

Skydiver

Staff member
Joined
Apr 6, 2019
Messages
5,245
Location
Chesapeake, VA
Programming Experience
10+
And also, how is this a C# question? Seems like a JavaScript question.
 

yunhyejeong

Well-known member
Joined
Dec 5, 2021
Messages
135
Programming Experience
1-3
Why would that error message be a surprise when your Watch window is telling you that Name is undefined? If you have a question is should be about line 23, not 26. Maybe you could take the time and make the effort to provide a FULL and CLEAR explanation of the problem. What exactly is that code supposed to be doing and why do you think it work?

The source has been uploaded.
please confirm
 

Skydiver

Staff member
Joined
Apr 6, 2019
Messages
5,245
Location
Chesapeake, VA
Programming Experience
10+

Skydiver

Staff member
Joined
Apr 6, 2019
Messages
5,245
Location
Chesapeake, VA
Programming Experience
10+
I don't know. This is a C# forum. You are asking a JavaScript question.
 

Skydiver

Staff member
Joined
Apr 6, 2019
Messages
5,245
Location
Chesapeake, VA
Programming Experience
10+
But if this where a JavaScript forum, I would point out that lines 26-27 of your screenshot seem to indicate that you want to modify attributes of the element with the id "img1101".

For some unknown reasons on lines 23-24 of your screenshot show you trying to the value of the element with the id "img1101" and then dangerously perform an eval() on value. Why?
 

yunhyejeong

Well-known member
Joined
Dec 5, 2021
Messages
135
Programming Experience
1-3
But if this where a JavaScript forum, I would point out that lines 26-27 of your screenshot seem to indicate that you want to modify attributes of the element with the id "img1101".

For some unknown reasons on lines 23-24 of your screenshot show you trying to the value of the element with the id "img1101" and then dangerously perform an eval() on value. Why?
Is there any other way?
 

Skydiver

Staff member
Joined
Apr 6, 2019
Messages
5,245
Location
Chesapeake, VA
Programming Experience
10+
Sorry. No.

Just re-read post #9. You obviously want to change the attributes of the element. So why don't you do that? Why are you trying to get the value of the element and then trying to evaluate that value?
 

jmcilhinney

C# Forum Moderator
Staff member
Joined
Apr 23, 2011
Messages
4,466
Location
Sydney, Australia
Programming Experience
10+
I asked you in post #2 to provide a FULL and CLEAR explanation of the problem and you still haven't done so. Stop expecting us to read your mind. Explain what you're actually trying to achieve. If you can't be bothered to help us help you, we're unlikely to help you.
 

yunhyejeong

Well-known member
Joined
Dec 5, 2021
Messages
135
Programming Experience
1-3
I asked you in post #2 to provide a FULL and CLEAR explanation of the problem and you still haven't done so. Stop expecting us to read your mind. Explain what you're actually trying to achieve. If you can't be bothered to help us help you, we're unlikely to help you.
I don't understand what you mean.
====> Your Answer) provide a FULL and CLEAR explanation
please explain easily
 

yunhyejeong

Well-known member
Joined
Dec 5, 2021
Messages
135
Programming Experience
1-3
Sorry. No.

Just re-read post #9. You obviously want to change the attributes of the element. So why don't you do that? Why are you trying to get the value of the element and then trying to evaluate that value?

I'm trying to blink an image with an ASP.NET timer.

If you look at the source I uploaded, there is an ASP.NET Timer source.
 

jmcilhinney

C# Forum Moderator
Staff member
Joined
Apr 23, 2011
Messages
4,466
Location
Sydney, Australia
Programming Experience
10+
I don't understand what you mean.
====> Your Answer) provide a FULL and CLEAR explanation
please explain easily
You just used up all the irony in the universe. That's what I'm telling you: EXPLAIN! If your post doesn't tell us, in detail, what you're trying to achieve, how you're trying to achieve it, what happens when you try and how that differs from your expectations then it is inadequate. Your posts are VERY inadequate.
 

Latest posts

Top Bottom