|
 |
aspx thread: Dynamically call JavaScript function
Message #1 by "Greg Quinn" <greg@i...> on Tue, 19 Feb 2002 12:45:03 -0800
|
|
In my for loop I need to call this JavaScript function every time.
What would be the right way to call this JavaScript, as I get an
'If' must end with a matching 'End If'. error if I call the below code...
if numMessages > 0 then
for i = 0 to numMessages
Dim jScriptString as String
jScriptString = "<SCRIPT LANGUAGE = 'JavaScript'>"
jScriptString += "setSize(" & theSize & ");"
jScriptString += "</SCRIPT>"
Response.Write(jScriptString)
next
end if
Message #2 by "dave wanta" <support@1...> on Tue, 19 Feb 2002 04:52:03 -0600
|
|
Just a hunch...
I think there is a problem with the "</SCRIPT>" tag...
try this:
jScriptString += "</SCR" + "IPT>";
Cheers!
dave wanta
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
http://www.123aspx.com
The Largest ASP.NET Web Directory!
Find the latest ASP.NET resources --
Subscribe to our newsletter!
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
----- Original Message -----
From: "Greg Quinn" <greg@i...>
To: "ASP+" <aspx@p...>
Sent: Tuesday, February 19, 2002 2:45 PM
Subject: [aspx] Dynamically call JavaScript function
> In my for loop I need to call this JavaScript function every time.
>
> What would be the right way to call this JavaScript, as I get an
> 'If' must end with a matching 'End If'. error if I call the below code...
>
>
> if numMessages > 0 then
> for i = 0 to numMessages
>
> Dim jScriptString as String
> jScriptString = "<SCRIPT LANGUAGE = 'JavaScript'>"
> jScriptString += "setSize(" & theSize & ");"
> jScriptString += "</SCRIPT>"
>
> Response.Write(jScriptString)
>
> next
> end if
>
>
>
Message #3 by "Greg Quinn" <greg@i...> on Tue, 19 Feb 2002 13:07:42 -0800
|
|
Thanks, that has helped, but unfortunately the calls to the JavaScript
function are being made before the JavaScript function is even written to
the browser, eg..
<SCRIPT>setSize(50, 1, 4)</SCRIPT><SCRIPT>setSize(100, 2,
4)</SCRIPT><SCRIPT>setSize(150, 3, 4)</SCRIPT><SCRIPT>setSize(200, 4,
4)</SCRIPT>
<html>
<head>
<script language = "JavaScript">
function setSize(theSize, currentMailCount, totalMailCount)
{
document.images['progessIMG'].width = theSize
tdProgress.innerText = "Receiving message " + currentMailCount + " of " +
totalMailCount
}
</script>
</head>
How do I call the function after the JavaScript function has been written to
the browser?
Greg
-----Original Message-----
From: dave wanta [mailto:support@1...]
Sent: 19 February 2002 02:52
To: ASP+
Subject: [aspx] Re: Dynamically call JavaScript function
Just a hunch...
I think there is a problem with the "</SCRIPT>" tag...
try this:
jScriptString += "</SCR" + "IPT>";
Cheers!
dave wanta
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
http://www.123aspx.com
The Largest ASP.NET Web Directory!
Find the latest ASP.NET resources --
Subscribe to our newsletter!
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
----- Original Message -----
From: "Greg Quinn" <greg@i...>
To: "ASP+" <aspx@p...>
Sent: Tuesday, February 19, 2002 2:45 PM
Subject: [aspx] Dynamically call JavaScript function
> In my for loop I need to call this JavaScript function every time.
>
> What would be the right way to call this JavaScript, as I get an
> 'If' must end with a matching 'End If'. error if I call the below code...
>
>
> if numMessages > 0 then
> for i = 0 to numMessages
>
> Dim jScriptString as String
> jScriptString = "<SCRIPT LANGUAGE = 'JavaScript'>"
> jScriptString += "setSize(" & theSize & ");"
> jScriptString += "</SCRIPT>"
>
> Response.Write(jScriptString)
>
> next
> end if
>
>
>
Message #4 by "dave wanta" <support@1...> on Tue, 19 Feb 2002 06:49:53 -0600
|
|
Drop an ASP:literal tag on the bottom of your .aspx page and write your
javascript like:
if numMessages > 0 then
for i = 0 to numMessages
Dim jScriptString as String
jScriptString = "<SCRIPT LANGUAGE = 'JavaScript'>"
jScriptString += "setSize(" & theSize & ");"
jScriptString += "</SCRIPT>"
literal1.text += jScriptString + Environment.NewLine;
next
end if
Cheers!
dave wanta
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
http://www.123aspx.com
The Largest ASP.NET Web Directory!
Find the latest ASP.NET resources --
Subscribe to our newsletter!
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
----- Original Message -----
From: "Greg Quinn" <greg@i...>
To: "ASP+" <aspx@p...>
Sent: Tuesday, February 19, 2002 3:07 PM
Subject: [aspx] Re: Dynamically call JavaScript function
> Thanks, that has helped, but unfortunately the calls to the JavaScript
> function are being made before the JavaScript function is even written to
> the browser, eg..
>
> <SCRIPT>setSize(50, 1, 4)</SCRIPT><SCRIPT>setSize(100, 2,
> 4)</SCRIPT><SCRIPT>setSize(150, 3, 4)</SCRIPT><SCRIPT>setSize(200, 4,
> 4)</SCRIPT>
>
> <html>
> <head>
> <script language = "JavaScript">
> function setSize(theSize, currentMailCount, totalMailCount)
> {
> document.images['progessIMG'].width = theSize
> tdProgress.innerText = "Receiving message " + currentMailCount + " of " +
> totalMailCount
> }
> </script>
> </head>
>
> How do I call the function after the JavaScript function has been written
to
> the browser?
>
> Greg
>
>
>
>
> -----Original Message-----
> From: dave wanta [mailto:support@1...]
> Sent: 19 February 2002 02:52
> To: ASP+
> Subject: [aspx] Re: Dynamically call JavaScript function
>
>
> Just a hunch...
> I think there is a problem with the "</SCRIPT>" tag...
>
> try this:
> jScriptString += "</SCR" + "IPT>";
>
> Cheers!
> dave wanta
> ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
> http://www.123aspx.com
> The Largest ASP.NET Web Directory!
> Find the latest ASP.NET resources --
> Subscribe to our newsletter!
> ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
>
> ----- Original Message -----
> From: "Greg Quinn" <greg@i...>
> To: "ASP+" <aspx@p...>
> Sent: Tuesday, February 19, 2002 2:45 PM
> Subject: [aspx] Dynamically call JavaScript function
>
>
> > In my for loop I need to call this JavaScript function every time.
> >
> > What would be the right way to call this JavaScript, as I get an
> > 'If' must end with a matching 'End If'. error if I call the below
code...
> >
> >
> > if numMessages > 0 then
> > for i = 0 to numMessages
> >
> > Dim jScriptString as String
> > jScriptString = "<SCRIPT LANGUAGE = 'JavaScript'>"
> > jScriptString += "setSize(" & theSize & ");"
> > jScriptString += "</SCRIPT>"
> >
> > Response.Write(jScriptString)
> >
> > next
> > end if
> >
> >
> >
>
>
>
>
>
Message #5 by "Greg Quinn" <greg@i...> on Tue, 19 Feb 2002 15:29:11 -0800
|
|
This does call the Javascript function, but only once the complete page has
rendered and all the mesages have been downloaded. Why is it not calling the
JavaScript while in the loop?
Greg
-----Original Message-----
From: dave wanta [mailto:support@1...]
Sent: 19 February 2002 04:50
To: ASP+
Subject: [aspx] Re: Dynamically call JavaScript function
Drop an ASP:literal tag on the bottom of your .aspx page and write your
javascript like:
if numMessages > 0 then
for i = 0 to numMessages
Dim jScriptString as String
jScriptString = "<SCRIPT LANGUAGE = 'JavaScript'>"
jScriptString += "setSize(" & theSize & ");"
jScriptString += "</SCRIPT>"
literal1.text += jScriptString + Environment.NewLine;
next
end if
Cheers!
dave wanta
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
http://www.123aspx.com
The Largest ASP.NET Web Directory!
Find the latest ASP.NET resources --
Subscribe to our newsletter!
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
----- Original Message -----
From: "Greg Quinn" <greg@i...>
To: "ASP+" <aspx@p...>
Sent: Tuesday, February 19, 2002 3:07 PM
Subject: [aspx] Re: Dynamically call JavaScript function
> Thanks, that has helped, but unfortunately the calls to the JavaScript
> function are being made before the JavaScript function is even written to
> the browser, eg..
>
> <SCRIPT>setSize(50, 1, 4)</SCRIPT><SCRIPT>setSize(100, 2,
> 4)</SCRIPT><SCRIPT>setSize(150, 3, 4)</SCRIPT><SCRIPT>setSize(200, 4,
> 4)</SCRIPT>
>
> <html>
> <head>
> <script language = "JavaScript">
> function setSize(theSize, currentMailCount, totalMailCount)
> {
> document.images['progessIMG'].width = theSize
> tdProgress.innerText = "Receiving message " + currentMailCount + " of " +
> totalMailCount
> }
> </script>
> </head>
>
> How do I call the function after the JavaScript function has been written
to
> the browser?
>
> Greg
>
>
>
>
> -----Original Message-----
> From: dave wanta [mailto:support@1...]
> Sent: 19 February 2002 02:52
> To: ASP+
> Subject: [aspx] Re: Dynamically call JavaScript function
>
>
> Just a hunch...
> I think there is a problem with the "</SCRIPT>" tag...
>
> try this:
> jScriptString += "</SCR" + "IPT>";
>
> Cheers!
> dave wanta
> ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
> http://www.123aspx.com
> The Largest ASP.NET Web Directory!
> Find the latest ASP.NET resources --
> Subscribe to our newsletter!
> ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
>
> ----- Original Message -----
> From: "Greg Quinn" <greg@i...>
> To: "ASP+" <aspx@p...>
> Sent: Tuesday, February 19, 2002 2:45 PM
> Subject: [aspx] Dynamically call JavaScript function
>
>
> > In my for loop I need to call this JavaScript function every time.
> >
> > What would be the right way to call this JavaScript, as I get an
> > 'If' must end with a matching 'End If'. error if I call the below
code...
> >
> >
> > if numMessages > 0 then
> > for i = 0 to numMessages
> >
> > Dim jScriptString as String
> > jScriptString = "<SCRIPT LANGUAGE = 'JavaScript'>"
> > jScriptString += "setSize(" & theSize & ");"
> > jScriptString += "</SCRIPT>"
> >
> > Response.Write(jScriptString)
> >
> > next
> > end if
> >
> >
> >
>
>
>
>
>
|
|
 |