Logo 
Search:

Asp.net Forum

Ask Question   UnAnswered
Home » Forum » Asp.net       RSS Feeds

asp.NET and javascript

  Asked By: Cory    Date: Feb 12    Category: Asp.net    Views: 1414
  

I want to incorporate a javascript function in one of my .aspx pages
and I'm getting all sorts of errors. Does anyone know how I go about
doing this? I have tried things like this:

sb.Append(@"<Script Language=""Javascript>""\n");

and this:

sb.Append("<Script Language="& Chr(34) & "Javascript>"& Chr(34) & "");

but it doesn't work. Any ideas?

Share: 

 

2 Answers Found

 
Answer #1    Answered By: Vinit Online     Answered On: Feb 12

use RegisterStartupScript()for registering
Javascript in your Programme and then you can use
it.Just see help of VS.NET for an example.

 
Answer #2    Answered By: Jake Williams     Answered On: Feb 12

A little late to the party, I know, but...

C# does not escape double quotes in the same way as VB. The first line should work  if you either (1) remove the @ and change "" to \", or (2) leave the @, change "" to ", and remove the \n (although of course then you'll have no line break).

 
Didn't find what you were looking for? Find more on asp.NET and javascript Or get search suggestion and latest updates.




Tagged: