G
Guest
Hello,
I would like to use variables with a type in jscript.NET.
I declare them as follows:
var x : double = 5.03;
This doesn't work in my script, that I write to the page in codebehind with
"registerClientScriptBlock" as follows:
string script = "<script language=jscript>";
script += "function test()";
script += ...
Page.RegisterClientScriptBlock("usefulName", script);
I can only use untyped variables like "var x = 5;" in these scripts what is
not useful for me.
For each function in the registered script block, I add an onclick-event to
a webcontrol button:
button1.Attributes.Add("OnClick", "return function1();");
This works when using the statement <script language="jscript"> in the
script block that I want to write to the page with
"Page.RegisterClientScriptBlock"
But when I change the script language to "js", the functions are not called
anymore when I click the corresponding buttons. An error message appears,
that an object does not exist. But with "js" as script language, I can use
variables with a type.
The same with the "vj#"-tag
With the one tag (vj#, js) , I can use variables with a type, but call no
functions,
with an other tag (jscript, the one I am using), I can call the functions,
but use no typed variables.
I need both "features", so I hope, somebody can tell me what I'm doing wrong.
As variables with a type are only available since jscript.NET, I don't know,
if
<script language="jscript"> specifies jscript.NET.
I hope somebody can help.
Thanks in advance & kind regards
RFS666
I would like to use variables with a type in jscript.NET.
I declare them as follows:
var x : double = 5.03;
This doesn't work in my script, that I write to the page in codebehind with
"registerClientScriptBlock" as follows:
string script = "<script language=jscript>";
script += "function test()";
script += ...
Page.RegisterClientScriptBlock("usefulName", script);
I can only use untyped variables like "var x = 5;" in these scripts what is
not useful for me.
For each function in the registered script block, I add an onclick-event to
a webcontrol button:
button1.Attributes.Add("OnClick", "return function1();");
This works when using the statement <script language="jscript"> in the
script block that I want to write to the page with
"Page.RegisterClientScriptBlock"
But when I change the script language to "js", the functions are not called
anymore when I click the corresponding buttons. An error message appears,
that an object does not exist. But with "js" as script language, I can use
variables with a type.
The same with the "vj#"-tag
With the one tag (vj#, js) , I can use variables with a type, but call no
functions,
with an other tag (jscript, the one I am using), I can call the functions,
but use no typed variables.
I need both "features", so I hope, somebody can tell me what I'm doing wrong.
As variables with a type are only available since jscript.NET, I don't know,
if
<script language="jscript"> specifies jscript.NET.
I hope somebody can help.
Thanks in advance & kind regards
RFS666