sending out Javascript from the server

B

Bjarke

I am working on an asp.net 2.0 web application, where I am making an
add to place on a different site. This add consists of some
dropdownboxes and some javascript.

the site on which the add is supposed to be has a table and the add is
included like this:

<td><script src="http:/someadress.aspx"></script> </td>

the source for the script consist of something like this:

document.write(" (the HTML for the add) ") and some more Javascript

I already have made the script file so it works

THE QUESTION

How do you use asp.net 2.0 (C#) to generate the javascript
dynamically????

Please help

Bjarke
 
B

Bjarke


Thanks Mark I know the RegisterStartupScript function. It adds
whatever you tell it to add to the beginning of a web page. What I
need is something that is possible to link to like this:

<script type="text/javascript" src="http://someAdress.aspx/
OrSomethingLikely"> (this snippet is supposed to be placed on a
different site that isnt even is powered by asp.net).

http://ditcentrum.dk/Nordjyske/OutputNordjyskeBlogs.aspx

Thanks


)
 
B

Bjarke


Thanks Mark I know the RegisterStartupScript function. It adds
whatever you tell it to add to the beginning of a web page. What I
need is something that is possible to link to like this:

<script type="text/javascript" src="http://someAdress.aspx/
OrSomethingLikely"> (this snippet is supposed to be placed on a
different site that isnt even is powered by asp.net).

just like this link does:

http://ditcentrum.dk/Nordjyske/OutputNordjyskeBlogs.aspx

when it referred to like this:

<html>
<body>

<script type = text/javascript src="http://ditcentrum.dk/Nordjyske/
OutputNordjyskeBlogs.aspx"></script>

</body>
</html>

Thanks

Thanks
 
?

=?ISO-8859-1?Q?G=F6ran_Andersson?=

Bjarke said:
I am working on an asp.net 2.0 web application, where I am making an
add to place on a different site. This add consists of some
dropdownboxes and some javascript.

I suppose that you mean an ad? ;)
the site on which the add is supposed to be has a table and the add is
included like this:

<td><script src="http:/someadress.aspx"></script> </td>

the source for the script consist of something like this:

document.write(" (the HTML for the add) ") and some more Javascript

I already have made the script file so it works

THE QUESTION

How do you use asp.net 2.0 (C#) to generate the javascript
dynamically????

Please help

Bjarke

Just remove all the markup in the page (except the @Page directive), and
use Response.Write in the code behind to write out the script as strings.
 
B

Bjarke

Just a small detail to finish the question.

The project I am working in is using themes. If I just delete
everything but the page directive I get an error.

So I disabled themes for that particular page as like it is shown
here
http://msdn2.microsoft.com/en-us/library/kx3kzht7(VS.80).aspx
on msdn.

I still get an error stating that I have to have a <head
runat="server"> section.

Is it possible to get rid of this?
 
?

=?ISO-8859-1?Q?G=F6ran_Andersson?=

Bjarke said:
Just a small detail to finish the question.

The project I am working in is using themes. If I just delete
everything but the page directive I get an error.

So I disabled themes for that particular page as like it is shown
here
http://msdn2.microsoft.com/en-us/library/kx3kzht7(VS.80).aspx
on msdn.

I still get an error stating that I have to have a <head
runat="server"> section.

Is it possible to get rid of this?

When I make a page where I don't want the theming, I just put Theme=""
in the @Page directive.
 

Ask a Question

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

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,769
Messages
2,569,582
Members
45,057
Latest member
KetoBeezACVGummies

Latest Threads

Top