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

  • Home
  • SEARCH
  • 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 5980363
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 22, 20262026-05-22T21:47:24+00:00 2026-05-22T21:47:24+00:00

When I use the Response.Write() method in asp.net to output javascript code, such as

  • 0

When I use the Response.Write() method in asp.net to output javascript code, such as the alert method, some of the css styles in this page are changed.

For example,when I use the code in asp.net like this:

Response.Write("<script>alert('success!')</script>");

When I run the file, first it popup the alert message, but after the page loads completely, I find that the font-size style is changed and becomes larger, but others don’t change.

I know use the Page.ClientScript.RegisterStartupScript() method that can solve the issue, but I want to know what causes this problem.

  • 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. Editorial Team
    Editorial Team
    2026-05-22T21:47:24+00:00Added an answer on May 22, 2026 at 9:47 pm

    That is because you are using Response.Write where you are not supposed to use it. You are using it outside of the code that is generating the page content, which means that you put the Javascript code outside of the HTML document.

    When you have anything before the doctype tag, the doctype is ignored and the page is parsed as tag soup instead of as a valid document, and it is rendered using Quirks Mode instead of Standards Compliance Mode. This affects how the HTML and CSS is interpreted, as the browser tries to emulate an ancient browser version, including all non-standard quirks, and errors. It will also use different default styles for the elements, which is the likely reason for the difference in font size that you see.

    Internet Explorer is especially sensetive when Quirks Mode is used. It will include the box model bug to try to be compatible with early versions of the browser.

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

Sidebar

Related Questions

I'm trying to use the ServerReport.RenderStream method from the ASP.NET ReportViewer (2008 SP1), but
After working with .NET's HttpWebRequest / Response objects, I'd rather shoot myself than use
I'm writing the RenderContents() method of my ASP.NET server control. The method uses an
every night i have a trigger that executes asp.net page with method that first
Hey I would like to use Nested Stored Procedures in ASP.NET 2. The first
I am actually rendering an excel file in the browser. I use the Response.Writefile(filePath)
I've been doing ASP.NET a little bit (on and off) over the last year,
I have encountered many half-solutions to the task of returning XML in ASP.NET. I
Firefox is for some reason not properly handling content sent through my .NET HTTP
I have an ASP.NET page that requires data from another DLL and the process

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.