Syntax Help - ASP.NET & javascript

Discussion in 'ASP .Net' started by Mike, Mar 9, 2008.

  1. Mike

    Mike Guest

    Hi. I have a unique problem. I have some HTML which displays correctly when
    I input it into an aspx page or html page. But when I use javascript's
    document.write() to write the html directly to the page, I get a script
    error. The nature of the program requires me to use document.write() instead
    of simply typing html directly.

    The html is pretty simple - It's just a table. I've uploaded the page below
    so you can see it...
    www.masonsolutions.net/testing/page.html

    As you can see, it looks fine here as regular HTML. But when I use
    document.write() I get a script error saying "Syntax Error Expected ')'".

    Could someone please let me know why this script error occurs when I use
    document.write? This is an asp.net project, and I know someone here can
    provide an answer, which is why I've posted here; please let me know if I
    should post elsewhere.

    Thanks!
     
    Mike, Mar 9, 2008
    #1
    1. Advertisements

  2. "Mike" <> wrote in message
    news:...

    > As you can see, it looks fine here as regular HTML. But when I use
    > document.write() I get a script error saying "Syntax Error Expected ')'".
    >
    > Could someone please let me know why this script error occurs when I use
    > document.write?


    Well, at the risk of stating the blindingly obvious, it occurs because
    you've missed a closing bracket somewhere...

    Do a View Source and inspect the generated JavaScript...


    --
    Mark Rae
    ASP.NET MVP
    http://www.markrae.net
     
    Mark Rae [MVP], Mar 9, 2008
    #2
    1. Advertisements

  3. Mike

    Mike Guest

    I've already done so, and there are no missing brackets.

    "Mark Rae [MVP]" wrote:

    > "Mike" <> wrote in message
    > news:...
    >
    > > As you can see, it looks fine here as regular HTML. But when I use
    > > document.write() I get a script error saying "Syntax Error Expected ')'".
    > >
    > > Could someone please let me know why this script error occurs when I use
    > > document.write?

    >
    > Well, at the risk of stating the blindingly obvious, it occurs because
    > you've missed a closing bracket somewhere...
    >
    > Do a View Source and inspect the generated JavaScript...
    >
    >
    > --
    > Mark Rae
    > ASP.NET MVP
    > http://www.markrae.net
    >
    >
     
    Mike, Mar 9, 2008
    #3
  4. "Mike" <> wrote in message
    news:...

    >> > As you can see, it looks fine here as regular HTML. But when I use
    >> > document.write() I get a script error saying "Syntax Error Expected
    >> > ')'".
    >> >
    >> > Could someone please let me know why this script error occurs when I
    >> > use
    >> > document.write?

    >>
    >> Well, at the risk of stating the blindingly obvious, it occurs because
    >> you've missed a closing bracket somewhere...
    >>
    >> Do a View Source and inspect the generated JavaScript...

    >
    > I've already done so, and there are no missing brackets.


    If you're absolutely certain about that, I would suggest building up the
    JavaScript a bit at a time until you find the line with the missing
    bracket... It may not be where you think it is...


    --
    Mark Rae
    ASP.NET MVP
    http://www.markrae.net
     
    Mark Rae [MVP], Mar 9, 2008
    #4
  5. There is an HTML-->Javascript converter form on this article page:

    http://www.eggheadcafe.com/articles/20060517.asp

    Paste your HTML into the top textarea, press the button, get correct
    Javascript in the bottom. View source on the page to get the code to make
    your own.

    -- Peter
    Site: http://www.eggheadcafe.com
    UnBlog: http://petesbloggerama.blogspot.com
    Short Urls & more: http://ittyurl.net


    "Mike" wrote:

    > Hi. I have a unique problem. I have some HTML which displays correctly when
    > I input it into an aspx page or html page. But when I use javascript's
    > document.write() to write the html directly to the page, I get a script
    > error. The nature of the program requires me to use document.write() instead
    > of simply typing html directly.
    >
    > The html is pretty simple - It's just a table. I've uploaded the page below
    > so you can see it...
    > www.masonsolutions.net/testing/page.html
    >
    > As you can see, it looks fine here as regular HTML. But when I use
    > document.write() I get a script error saying "Syntax Error Expected ')'".
    >
    > Could someone please let me know why this script error occurs when I use
    > document.write? This is an asp.net project, and I know someone here can
    > provide an answer, which is why I've posted here; please let me know if I
    > should post elsewhere.
    >
    > Thanks!
     
    Peter Bromberg [C# MVP], Mar 10, 2008
    #5
  6. Mike

    Mike Guest

    I'm not infront of my development machine now, but this looks promising and I
    wanted to say thank you for pointing me here. I can't wait to try it!

    "Peter Bromberg [C# MVP]" wrote:

    > There is an HTML-->Javascript converter form on this article page:
    >
    > http://www.eggheadcafe.com/articles/20060517.asp
    >
    > Paste your HTML into the top textarea, press the button, get correct
    > Javascript in the bottom. View source on the page to get the code to make
    > your own.
    >
    > -- Peter
    > Site: http://www.eggheadcafe.com
    > UnBlog: http://petesbloggerama.blogspot.com
    > Short Urls & more: http://ittyurl.net
    >
    >
    > "Mike" wrote:
    >
    > > Hi. I have a unique problem. I have some HTML which displays correctly when
    > > I input it into an aspx page or html page. But when I use javascript's
    > > document.write() to write the html directly to the page, I get a script
    > > error. The nature of the program requires me to use document.write() instead
    > > of simply typing html directly.
    > >
    > > The html is pretty simple - It's just a table. I've uploaded the page below
    > > so you can see it...
    > > www.masonsolutions.net/testing/page.html
    > >
    > > As you can see, it looks fine here as regular HTML. But when I use
    > > document.write() I get a script error saying "Syntax Error Expected ')'".
    > >
    > > Could someone please let me know why this script error occurs when I use
    > > document.write? This is an asp.net project, and I know someone here can
    > > provide an answer, which is why I've posted here; please let me know if I
    > > should post elsewhere.
    > >
    > > Thanks!
     
    Mike, Mar 10, 2008
    #6
    1. Advertisements

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. David Virgil Hobbs
    Replies:
    0
    Views:
    666
    David Virgil Hobbs
    Jan 6, 2004
  2. Replies:
    1
    Views:
    1,135
    Kevin Spencer
    Aug 10, 2005
  3. Replies:
    5
    Views:
    730
    =?Utf-8?B?Q3VydF9DIFtNVlBd?=
    Sep 14, 2005
  4. Bonggoy Cruz
    Replies:
    7
    Views:
    4,181
    =?Utf-8?B?RHVzdGluIHZhbiBkZSBTYW5kZSBbTUNBRF0=?=
    Apr 14, 2006
  5. alanX
    Replies:
    1
    Views:
    450
    Supriya
    Jul 7, 2006
  6. Ken
    Replies:
    2
    Views:
    441
  7. Jamie Sutherland

    Help with vb.net Maths syntax in asp.net

    Jamie Sutherland, Oct 25, 2007, in forum: ASP .Net Web Controls
    Replies:
    1
    Views:
    284
    Phil H
    Oct 25, 2007
  8. Dr DOOM
    Replies:
    2
    Views:
    302
    Dr DOOM
    Aug 10, 2003
Loading...