Solved

<script runat=server> to hold Javascript?

Posted on 2006-06-22
5
413 Views
Last Modified: 2006-11-18
Currently i can modify a style sheet during page load.  However, if i want to do this with javascript i need to make a <script runat=server> tag, but then it automatically think's is asp.net code and it's causing errors.

I am after a way to basically do 1 check and to determine what url(src) to use.  The only way i can get it to work is to just Response.Write the whole tag, but that's not a nice solution.  

Does anyone have any ideas?  
0
Comment
Question by:UnexplainedWays
  • 3
5 Comments
 
LVL 4

Expert Comment

by:dukestaTAI
ID: 16962790
Are you using asp.net? If so which version, 1.1 or 2.0?
0
 
LVL 12

Author Comment

by:UnexplainedWays
ID: 16964092
2
0
 
LVL 12

Author Comment

by:UnexplainedWays
ID: 16974332
Guess im trying to do the impossible.
0
 
LVL 3

Accepted Solution

by:
mistaeverly earned 500 total points
ID: 16974481
I'm not sure exactly what you're asking.  You want to modify a style sheet during page load?  Not sure if it helps, but I've linked to an outside javascript file like this before:

<script src="<%= ScriptUrl %>" type="text/javascript"></script>

In this case, ScriptUrl is a public string variable declared in my code-behind.
Hope this helps.


0
 
LVL 12

Author Comment

by:UnexplainedWays
ID: 16974501
I'm after something like that.  What i was trying to do was:

MyUrl

TheScript.src = MyUrl+TheScript.src;


I dont know what MyUrl is untill the page creation.  So to do that i would need to have a runat=server, and as soon as i go down that path i hit the 'not asp.net' brick wall.


The reason why i tried to do change the url like this, is during development (in VS), i was doing the same with style sheets, and then my page would look funny because the sheets only come into action when the page is loaded.

However, thinkign about it a bit more, i realise that VS doesn't do any javascript linking (like how it modifies with css in the development environment).  So i'll have to try that, it should work.
0

Featured Post

DevOps Toolchain Recommendations

Read this Gartner Research Note and discover how your IT organization can automate and optimize DevOps processes using a toolchain architecture.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

I've been asked to discuss some of the UX activities that I'm using with my team. Here I will share some details about how we approach UX projects.
FAQ pages provide a simple way for you to supply and for customers to find answers to the most common questions about your company. Here are six reasons why your company website should have a FAQ page
This tutorial demonstrates how to identify and create boundary or building outlines in Google Maps. In this example, I outline the boundaries of an enclosed skatepark within a community park.  Login to your Google Account, then  Google for "Google M…
The viewer will learn how to look for a specific file type in a local or remote server directory using PHP.

820 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question