473,399 Members | 3,888 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,399 software developers and data experts.

Casting Javascript in header section of Html/ASP.NET page using C#

Hi there i have written the following code in C# and was wondering how i can output the script between the <Head></Head> tags i cant use literal as using master page

Expand|Select|Wrap|Line Numbers
  1.             StringBuilder script = new StringBuilder();
  2.  
  3.             script.Append("<script src=\"/js/dw_rotator.js\" type=\"text/javascript\"></script>");
  4.             script.Append(Environment.NewLine);
  5.             script.Append("<script type=\"text/javascript\">");
  6.             script.Append(Environment.NewLine);
  7.  
  8.             script.Append("function initRotator(){");
  9.             script.Append(Environment.NewLine);
  10.             script.AppendFormat("var rotator1 = new dw_Rotator('{0}', 3500);", ImageHomePage.ClientID);
  11.             script.Append(Environment.NewLine);
  12.            // script.AppendFormat("rotator1.addImages({0})", images.ToArray().ToString());
  13.             script.AppendFormat("rotator1.addImages(\"smile.gif\", \"grim.gif\", \"frown.gif\", \"bomb.gif\");"); 
  14.             script.Append(Environment.NewLine);
  15.            // script.AppendFormat("rotator1.addActions({0})", links.ToArray().ToString());
  16.             script.AppendFormat("rotator1.addActions(\"http://www.dyn-web.com/javascript/rotate-img/\", \"http://www.dyn-web.com\", \"just-rotate.html\", \"http://www.dyn-web.com/bus/terms.html\");") ; 
  17.             script.Append(Environment.NewLine);
  18.             script.Append("dw_Rotator.start();");
  19.             script.Append(Environment.NewLine);
  20.             script.Append("}");
  21.             script.Append(Environment.NewLine);
  22.             script.Append("</script>");
  23.  
  24.  
  25.            Page.ClientScript.RegisterStartupScript(this.GetType(), "imageRotation", script.ToString());
  26.  
Feb 21 '08 #1
0 986

Sign in to post your reply or Sign up for a free account.

Similar topics

111
by: Retlak | last post by:
The recommended (on dozens of websites) and effective (works in Netscape, MSIE, Mozilla, probably others) way to detect if a browser has Javascript turned off is to put this in the <head>: ...
3
by: bloc | last post by:
I am programming an interactive CV using xml, xslt and java script. The page consists of a header which contains links to various 'sections' on the xml cv, a left and right menu, and a central...
6
by: adamscybot | last post by:
Here is the site in question: http://www.sws.vxcomputers.com/h2k/ Basically, on the left, you'll see a roster (them images) and you have to click the "Counter-Strike" link for it to load the...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
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: 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
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...

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.