|
 |
asp_web_howto thread: Re: How to display ASP page values in JavaScript
Message #1 by Paul R Stearns <pauls@c...> on Tue, 25 Jun 2002 17:28:55 -0400
|
|
Forgot a trailing ); on the var jsarray line...
Paul R Stearns wrote:
> Rob:
>
> You are trying to display a server variable at the client... It ain't gonna
> happen...
>
> You might try;
>
> <html>
> <head>
> <title>button click</title>
> <%
> dim mm(3)
> mm(0)="w-0"
> mm(1)="w-1"
> mm(2)="w-2"
> %>
> <script language=javascript>
>
> function button_click(action_type)
> {
> var jsarray new Array(<% ="'"&mm(0)&"',"&mm(1)&"',"&mm(2)&"'" %>);
> alert(action_type);
> alert(jsarray[2]);
> }
> </script>
> </head>
> <FORM NAME="edit_form">
> <body>
> <TABLE border="0" >
> <TR VALIGN=right>
> <TD WIDTH="50%" ALIGN=left>
> Action :
> <INPUT TYPE=BUTTON NAME=VIEW_DETAIL VALUE="View"
> onclick="button_click(this.value)">
> </SMALL>
> </FORM>
> </body>
> </TD>
> </TR>
> </TABLE>
> <%
> response.write "Should show when click on view : " &mm(2)
> %>
>
> I wasn't real clear on where edit_form.mm[2].value was coming from since I didn't
> see an input tag by that name.
>
> Paul
>
> "Rob v. Osnabrugge" wrote:
>
> > Hi,
> >
> > I'm trying to display the value of array-variable (defined in the ASP
> > code) in a JavaScript when I click a button. I just got "error on page".
> > Has anyone an idea what I'm doing wrong ?
> > Thanks,
> > Rob
> >
> > <html>
> > <head>
> > <title>button click</title>
> > <script language=javascript>
> >
> > function button_click(action_type)
> > {
> > alert(action_type);
> > alert(edit_form.mm[2].value);
> > }
> > </script>
> > </head>
> > <FORM NAME="edit_form">
> > <%
> > dim mm(3)
> > mm(0)="w-0"
> > mm(1)="w-1"
> > mm(2)="w-2"
> > %>
> > <body>
> > <TABLE border="0" >
> > <TR VALIGN=right>
> > <TD WIDTH="50%" ALIGN=left>
> > Action :
> > <INPUT TYPE=BUTTON NAME=VIEW_DETAIL VALUE="View"
> > onclick="button_click(this.value)">
> > </SMALL>
> > </FORM>
> > </body>
> > </TD>
> > </TR>
> > </TABLE>
> > <%
> > response.write "Should show when click on view : " &mm(2)
> > %>
> >
> > ---
> >
> > Improve your web design skills with these new books from Glasshaus.
> >
> > Usable Web Menus
> > http://www.amazon.com/exec/obidos/ASIN/1904151027/ref=nosim/theprogramme
> > r-20
> > Constructing Accessible Web Sites
> > http://www.amazon.com/exec/obidos/ASIN/1904151000/ref=nosim/theprogramme
> > r-20
> > Practical JavaScript for the Usable Web
> > http://www.amazon.com/exec/obidos/ASIN/1904151051/ref=nosim/theprogramme
> > r-20
>
> ---
>
> Improve your web design skills with these new books from Glasshaus.
>
> Usable Web Menus
> http://www.amazon.com/exec/obidos/ASIN/1904151027/ref=nosim/theprogramme
> r-20
> Constructing Accessible Web Sites
> http://www.amazon.com/exec/obidos/ASIN/1904151000/ref=nosim/theprogramme
> r-20
> Practical JavaScript for the Usable Web
> http://www.amazon.com/exec/obidos/ASIN/1904151051/ref=nosim/theprogramme
> r-20
Message #2 by Paul R Stearns <pauls@c...> on Tue, 25 Jun 2002 17:23:15 -0400
|
|
Rob:
You are trying to display a server variable at the client... It ain't gonna
happen...
You might try;
<html>
<head>
<title>button click</title>
<%
dim mm(3)
mm(0)="w-0"
mm(1)="w-1"
mm(2)="w-2"
%>
<script language=javascript>
function button_click(action_type)
{
var jsarray new Array(<% ="'"&mm(0)&"',"&mm(1)&"',"&mm(2)&"'" %>
alert(action_type);
alert(jsarray[2]);
}
</script>
</head>
<FORM NAME="edit_form">
<body>
<TABLE border="0" >
<TR VALIGN=right>
<TD WIDTH="50%" ALIGN=left>
Action :
<INPUT TYPE=BUTTON NAME=VIEW_DETAIL VALUE="View"
onclick="button_click(this.value)">
</SMALL>
</FORM>
</body>
</TD>
</TR>
</TABLE>
<%
response.write "Should show when click on view : " &mm(2)
%>
I wasn't real clear on where edit_form.mm[2].value was coming from since I didn't
see an input tag by that name.
Paul
"Rob v. Osnabrugge" wrote:
> Hi,
>
> I'm trying to display the value of array-variable (defined in the ASP
> code) in a JavaScript when I click a button. I just got "error on page".
> Has anyone an idea what I'm doing wrong ?
> Thanks,
> Rob
>
> <html>
> <head>
> <title>button click</title>
> <script language=javascript>
>
> function button_click(action_type)
> {
> alert(action_type);
> alert(edit_form.mm[2].value);
> }
> </script>
> </head>
> <FORM NAME="edit_form">
> <%
> dim mm(3)
> mm(0)="w-0"
> mm(1)="w-1"
> mm(2)="w-2"
> %>
> <body>
> <TABLE border="0" >
> <TR VALIGN=right>
> <TD WIDTH="50%" ALIGN=left>
> Action :
> <INPUT TYPE=BUTTON NAME=VIEW_DETAIL VALUE="View"
> onclick="button_click(this.value)">
> </SMALL>
> </FORM>
> </body>
> </TD>
> </TR>
> </TABLE>
> <%
> response.write "Should show when click on view : " &mm(2)
> %>
>
> ---
>
> Improve your web design skills with these new books from Glasshaus.
>
> Usable Web Menus
> http://www.amazon.com/exec/obidos/ASIN/1904151027/ref=nosim/theprogramme
> r-20
> Constructing Accessible Web Sites
> http://www.amazon.com/exec/obidos/ASIN/1904151000/ref=nosim/theprogramme
> r-20
> Practical JavaScript for the Usable Web
> http://www.amazon.com/exec/obidos/ASIN/1904151051/ref=nosim/theprogramme
> r-20
Message #3 by "Rob v. Osnabrugge" <osnabrr@h...> on Tue, 25 Jun 2002 21:59:53
|
|
Hi,
I'm trying to display the value of array-variable (defined in the ASP
code) in a JavaScript when I click a button. I just got "error on page".
Has anyone an idea what I'm doing wrong ?
Thanks,
Rob
<html>
<head>
<title>button click</title>
<script language=javascript>
function button_click(action_type)
{
alert(action_type);
alert(edit_form.mm[2].value);
}
</script>
</head>
<FORM NAME="edit_form">
<%
dim mm(3)
mm(0)="w-0"
mm(1)="w-1"
mm(2)="w-2"
%>
<body>
<TABLE border="0" >
<TR VALIGN=right>
<TD WIDTH="50%" ALIGN=left>
Action :
<INPUT TYPE=BUTTON NAME=VIEW_DETAIL VALUE="View"
onclick="button_click(this.value)">
</SMALL>
</FORM>
</body>
</TD>
</TR>
</TABLE>
<%
response.write "Should show when click on view : " &mm(2)
%>
|
|
 |