473,385 Members | 1,766 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,385 software developers and data experts.

Dynamic Creation of Javascript Code

Good Day Folks,

I'm trying to dynamically create some Javascript code. The simplest form of
my asp.net code is shown below. Seems the compiler doesn't like the string
constant "</script>".

Any way around this ?
Thanks in advance
/Serge
Contents of "colorscheme.vb"
---------------------------------

<script runat="server">
Sub CreateColorSchemeJava()
Response.write("<script language=""Javascript"">" & vbcrlf)
Response.write("</script>" & vbcrlf) ' Error generated here.
End Sub
</script>
Contents of Main ASPX script.

<%@ Page Explicit="True" Language="VB" Debug="true"%>
<!--#include file="ColorScheme.vb"-->

<html>
<head>
<title></title>
<%
CreateColorSchemeJava()
%>
</head>
<body>

</body>
</html>

Compiler Error
----------------

String constants must end with a double quote. Error Line 6

Line 4:
Line 5: Response.write("<script language=""Javascript"">" & vbcrlf)
Line 6: Response.write("</script>" & vbcrlf)
Line 7:
Line 8: End Sub
Dec 21 '05 #1
1 1083
Serge <Se***@discussions.microsoft.com> wrote:
Good Day Folks,

I'm trying to dynamically create some Javascript code. The simplest form of
my asp.net code is shown below. Seems the compiler doesn't like the string
constant "</script>".

Any way around this ?


A couple of ways:
1) Use a code-behind instead of including the file
2) Use "</scr" & "ipt>" instead of "</script>"

--
Jon Skeet - <sk***@pobox.com>
http://www.pobox.com/~skeet Blog: http://www.msmvps.com/jon.skeet
If replying to the group, please do not mail me too
Dec 21 '05 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

13
by: mr_burns | last post by:
hi, is it possible to change the contents of a combo box when the contents of another are changed. for example, if i had a combo box called garments containing shirts, trousers and hats, when...
5
by: Stuart | last post by:
Hi We have a dynamically created javascript menu (from ASP), which is customised per user (Have already taken all the static code out into separate cached .js file) The size of the 'dynamic'...
5
by: Tompa | last post by:
Hi, I would like to create images on the fly as a response to an http request. I can do this with PIL like this (file create_gif.py): from PIL import Image, ImageDraw print 'Status: 200 OK'...
0
by: Pascal Costanza | last post by:
Dynamic Languages Day @ Vrije Universiteit Brussel ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ Monday, February 13, 2006, VUB Campus Etterbeek The VUB (Programming Technology Lab,...
8
by: william_dean | last post by:
Hello, I've done some searching around the post, and I have found quite a bit of information related to the setAttribute and it's related uses. My problem lies in the usage of colspanning in dynamic...
1
by: redbaks | last post by:
Hi! I am trying to implement adding widgets to our template editor (for blogs). I am worried that i might open a window for XSS attacks so i decided to enveloped all widgets inside an iframe. ...
3
polymorphic
by: polymorphic | last post by:
I have succeeded in embedding PDF files in a dynamic iframe. The problem is that I need the PDF to cache. If the PDF remains the same from page load to page load then the pdf is somehow cached with...
3
by: arunank | last post by:
Hi, The following code for dynamic table creation is not working. Can anyone please help me. The dynamically created rows and columns are not getting populated. CODE: ========= <html>
1
by: cdmsenthil | last post by:
I have an Infragistics UltrawebGrid . Each Row in the grid is attached to a context menu using Infragistics CSOM Upon click on the menu, I am creating an Iframe dynamically which points to...
3
by: tokcy | last post by:
hi everyone, i am creating dynamic row in a table using javascript its working fine and now i want to create more than 1 table using javascript which is dynamic its also working fine but when i am...
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.