Sorry for the spam. Actually my issue is that I am trying to keep my
html file neat and tidy by putting all my javascript code in a
separate js file. But my javascript code refers to some server side
variable values which exists in an asp file. I have included that asp
file in my main asp file along with the js file. But the js file
dosn't seems to get server variable values. Here is a broad view of my
code.

mainpage.asp
----------> <!--#include virtual = "/mywebsite/child1.asp" -->
----------> <script type="text/javascript" src="child1.js"></script>

child1.asp
----------> CONST myvar = 100

child1.js
----------> alert(<%= myvar%>);

But alert is giving error. Please advice change in the code if any. I
can put the alert code in mainpage.asp too, but that will make my asp
page full of javascript functions. I want to keep mainpage.asp clean.
Thanks for the response.



On Dec 10, 12:25 pm, brian <[EMAIL PROTECTED]> wrote:
> Please keep your threads tidy. Don't spam the list with the same question.
>
> The file that contains the line:
>
> var myvalue = "<%= myservervalue%>";
>
> ... is a .js file, right? It's been a long time, but I'm guessing the
> ASP interpreter isn't set by default to parse .js files.
>
> Put the line in the head of the HTML file you're creating (ie. your ASP 
> script):
>
> <script type="text/javascript">
> var myvalue = "<%= myservervalue%>";
> </script>
>
> And it's really not a good idea to create your own attributes for HTML
> elements. Not unless you reference your own
> DTD and, even then, you're looking for trouble.
>
> On Wed, Dec 10, 2008 at 12:34 AM, JQueryProgrammer
>
> <[EMAIL PROTECTED]> wrote:
>
> > I am migrating my existing ASP application javascript code to jquery.
> > However places where i want to get the value from server, I am getting
> > an error like:
>
> > var myvalue = "<%= myservervalue%>";
>
> > when i check in myvalue, it is populated with <%= myservervalue%> as
> > string. If I try to remove "" then it gives an error in comparison.
> > Any help would be appreciated.

Reply via email to