JavaScript closing script tag and document.write gets flagged in Visual Studio

Environment: Visual Studio 2008 SP1, ASP.NET and JavaScript

I'm trying to do a quick document.write test but as soon as I add script tags Visual Studio editor doesn't like it. Specifically, the closing script tag? I get those squiggly lines as soon as I enter the closing </script> tag

<html><head></head><body>
    <script type='text/javascript'>
      document.write('<html><head><script></script></head><body></body></html>');
    </script>
</body>
</html>
Answer:1

Use:

document.write('<html><head><script><\/script></head><body></body></html>');
Note the `\`, here ------------------^

Another option is to split the string, so that it's not a exact tag:

document.write('<html><head><script></sc' + 'ript></head><body></body></html>');

Here's a reference explaining why it's needed, and other options:

  • Why split the <script> tag when writing it with document.write()?

Anyways, why are you writing a whole document into the <body>?

Answer:2

Weird, line one works fine but line 3 give me TypeError: dojo.byId(...).attr is not a function. There is hidden fields that hold all student pair that as <input type="hidden" id="...

Weird, line one works fine but line 3 give me TypeError: dojo.byId(...).attr is not a function. There is hidden fields that hold all student pair that as <input type="hidden" id="...

I am attempting to run a script in a webpage, that should be executed in an <iframe>. Right now I can call a function that is set within the <iframe>.. I'm just having issues running a ...

I am attempting to run a script in a webpage, that should be executed in an <iframe>. Right now I can call a function that is set within the <iframe>.. I'm just having issues running a ...

  1. javascript iframe content
  2. javascript iframe contentwindow
  3. javascript iframe contentdocument
  4. javascript iframe contentdocument is null
  5. javascript iframe content height
  6. javascript iframe content loaded
  7. javascript iframe content change event
  8. javascript iframe content find
  9. javascript iframe contentwindow null
  10. javascript iframe content size
  11. javascript iframe contentwindow restricted
  12. javascript iframe content cross domain
  13. javascript iframe contentwindow postmessage
  14. javascript iframe content change
  15. javascript iframe contentwindow access denied
  16. javascript iframe contentdocument access denied
  17. javascript iframe contentwindow.document
  18. javascript iframe content height cross domain
  19. javascript iframe content type
  20. javascript iframe content parent

I started using html twig in Symfony2 and I got the following problem: function goEditConflict(){ $("#go").on("click", function(){ id = $("#case_number").val(); windows.location = {{ ...

I started using html twig in Symfony2 and I got the following problem: function goEditConflict(){ $("#go").on("click", function(){ id = $("#case_number").val(); windows.location = {{ ...

  1. parsing variable from javascript to php
  2. parsing variable in javascript
  3. parsing variable in java
  4. parsing parameters from url
  5. parsing variable in bash
  6. passing variable in sed
  7. passing variable in jquery
  8. passing variable in mysql
  9. passing variable in informatica
  10. parsing variable in xml

We used to be able to enter a search field, address on search box, hit the ENTER key on the keyboard and get the search results. I made several changes but can't pinpoint the change that resulted in ...

We used to be able to enter a search field, address on search box, hit the ENTER key on the keyboard and get the search results. I made several changes but can't pinpoint the change that resulted in ...