Expiring Today—Celebrate National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

<script runat=server> to hold Javascript?

Posted on 2006-06-22
5
Medium Priority
?
418 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 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 2000 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

Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

Originally, this post was published on Monitis Blog, you can check it here . It goes without saying that technology has transformed society and the very nature of how we live, work, and communicate in ways that would’ve been incomprehensible 5 ye…
Dramatic changes are revolutionizing how we build and use technology. Every company is automating, digitizing, and modernizing operations. We need a better, more connected way to work together as teams so we can harness the insights from our system…
The viewer will learn how to look for a specific file type in a local or remote server directory using PHP.
The viewer will get a basic understanding of what section 508 compliance can entail, learn about skip navigation links, alt text, transcripts, and font size controls.
Suggested Courses

730 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