Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 129861
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 11, 20262026-05-11T05:51:25+00:00 2026-05-11T05:51:25+00:00

After converting an ASP.NET webform (v3.5) to use a master page, I started getting

  • 0

After converting an ASP.NET webform (v3.5) to use a master page, I started getting a strange Javascript error.

The content page has a block of javascript. Here it is:

 <script type='text/javascript'>      var attCount = 0;      function CreateAttachmentControl() {         var newAtt = document.createElement('span');         var newAttName = 'area' + attCount;         newAtt.setAttribute('id', newAttName);         newAtt.setAttribute('name', newAttName);          var newInput = document.createElement('input');         var newInputName = 'att' + attCount;         newInput.setAttribute('type', 'file');         newInput.setAttribute('id', newInputName);         newInput.setAttribute('name', newInputName);          if (newInput.addEventListener) {             newInput.addEventListener('onchange', CreateAttachmentControl, false);         } else if (newInput.attachEvent) {             newInput.attachEvent('onchange', CreateAttachmentControl);         } else {             newInput.onchange = CreateAttachmentControl;         }          var newRemove = document.createElement('a');         newRemove.setAttribute('href', 'javascript:RemoveAttachmentControl('' + attCount + '')');         newRemove.setAttribute('title', 'Remove this attachment');         newRemove.innerHTML = 'X';         newAtt.appendChild(newInput);         newAtt.appendChild(document.createTextNode(' '));         newAtt.appendChild(newRemove);         newAtt.appendChild(document.createElement('br'));         attArea.appendChild(newAtt); // error here          attCount++;     }      function RemoveAttachmentControl(n) {          // get input element         var input = document.getElementById('att' + n);          // if the input is blank dont delete         if (input.value != '' && input.value != null) {             var att = document.getElementById('area' + n);             attArea.removeChild(att);         }     } </script> 

The error is: ‘attArea’ is undefined

But, I know that it is not, because just below my block of javascript is this:

...<td align='left' colspan='2' style='height: 13px' id='attArea' name='attArea'></td>... 

This working perfectly before I converted the webform into content page with a master page. Is there some known Javascript + Masterpage issues?

Thanks

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. 2026-05-11T05:51:26+00:00Added an answer on May 11, 2026 at 5:51 am

    In the code sample you provided, attArea is undefined. The first reference to it you are calling attArea.appendChild(). Is it declared somewhere higher in the source that you didn’t provide?

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

After converting a Hybrid ASP.NET MVC1 app to MVC2 I'm getting the following error
I converted my website from asp.net mvc 1.0 to 2.0. After converting that i
Today I faced a strange problem in C#. I have an ASP.NET page where
Getting this after solving a Error converting data type nvarchar to datetime error. Using
Consider the scenario of upgrading an ASP.NET MVC project. This question is around up-converting
I'm developing the most simple ASP.NET application which is giving me an annoying error.
After the suggestion to use a library for my ajax needs I am going
I have an ASP.Net form, where it grabs a value from a textbox: <asp:TextBox
I have trouble in setting the equal condition on a datetime field after converting
I have a problem with different sound libraries... I use Visual Studio.NET and C#

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.