Hello,
I am trying to put a very simple animation on a page. I want two images to
show alternately in a defined area. I tried to have an image control and a
timer control on a page. I am setting the Imageurl property of the image
control to two difeent images at fixed time interval. but the image remains
fixed on my page. It never resets to other image. Perhaps I need to Refresh
the page at every timeinterval.
My code is as
Private Sub Page_Load(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles MyBase.Load
'Put user code to initialize the page here
SetTimer()
End Sub
Private Sub SetTimer()
Try
AddHandler Timer1.Elapsed, AddressOf OnTimer
Timer1.Enabled = True
Timer1.Interval = 1000
Timer1.Start()
Image1.ImageUrl = "C:\Sunset.jpg"
Catch ex As Exception
Response.Write(ex.Message)
End Try
End Sub
Public Sub OnTimer(ByVal source As Object, ByVal e As ElapsedEventArgs)
Try
If Image1.ImageUrl = "C:\Sunset.jpg" Then
Image1.ImageUrl = "C:\Winter.jpg"
Else
Image1.ImageUrl = "C:\Sunset.jpg"
End If
Catch ex As Exception
Response.write(ex.Message)
End Try
End Sub
Any suggestion shall be appreciated.
Cheers,
siaj 3 2708
You should do it in the JavaScript on the client so:
function init()
{
timer = setInterval("TrackFrame()",500);
}
function TrackFrame()
{
//toggle image here
}
and call the init function from the body.
"siaj" <si**@discussions.microsoft.com> wrote in message
news:00**********************************@microsof t.com... Hello, I am trying to put a very simple animation on a page. I want two images to show alternately in a defined area. I tried to have an image control and a timer control on a page. I am setting the Imageurl property of the image control to two difeent images at fixed time interval. but the image remains fixed on my page. It never resets to other image. Perhaps I need to Refresh the page at every timeinterval.
My code is as
Private Sub Page_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load 'Put user code to initialize the page here SetTimer() End Sub
Private Sub SetTimer() Try AddHandler Timer1.Elapsed, AddressOf OnTimer Timer1.Enabled = True Timer1.Interval = 1000
Timer1.Start() Image1.ImageUrl = "C:\Sunset.jpg" Catch ex As Exception Response.Write(ex.Message) End Try End Sub
Public Sub OnTimer(ByVal source As Object, ByVal e As ElapsedEventArgs) Try If Image1.ImageUrl = "C:\Sunset.jpg" Then Image1.ImageUrl = "C:\Winter.jpg" Else Image1.ImageUrl = "C:\Sunset.jpg" End If
Catch ex As Exception Response.write(ex.Message) End Try End Sub Any suggestion shall be appreciated.
Cheers, siaj
Thanks for quick reply...
I tried the way u suggested though I had two doubts..
My Javascript code goes as
<script language ="javascript" >
var flag = true;
function init()
{
alert("I m here!");
timer = setInterval("TrackFrame",500);
}
function TrackFrame()
{
if flag == false
{
alert("toggling");
flag = true;
}
else
{
alert("toggled");
flag = false;
}
}
</script>
I call from the body as
<body MS_POSITIONING="GridLayout" onload = "init()">
My doubts are that I get an error Expected "("
also If you can tell me how to toggle the image in javascript.
Let me confess that I am a beginner in web development.
Appreciate your help..
Cheers,
siaj
"Joseph Byrns" wrote: You should do it in the JavaScript on the client so:
function init() { timer = setInterval("TrackFrame()",500); }
function TrackFrame() { //toggle image here }
and call the init function from the body.
"siaj" <si**@discussions.microsoft.com> wrote in message news:00**********************************@microsof t.com... Hello, I am trying to put a very simple animation on a page. I want two images to show alternately in a defined area. I tried to have an image control and a timer control on a page. I am setting the Imageurl property of the image control to two difeent images at fixed time interval. but the image remains fixed on my page. It never resets to other image. Perhaps I need to Refresh the page at every timeinterval.
My code is as
Private Sub Page_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load 'Put user code to initialize the page here SetTimer() End Sub
Private Sub SetTimer() Try AddHandler Timer1.Elapsed, AddressOf OnTimer Timer1.Enabled = True Timer1.Interval = 1000
Timer1.Start() Image1.ImageUrl = "C:\Sunset.jpg" Catch ex As Exception Response.Write(ex.Message) End Try End Sub
Public Sub OnTimer(ByVal source As Object, ByVal e As ElapsedEventArgs) Try If Image1.ImageUrl = "C:\Sunset.jpg" Then Image1.ImageUrl = "C:\Winter.jpg" Else Image1.ImageUrl = "C:\Sunset.jpg" End If
Catch ex As Exception Response.write(ex.Message) End Try End Sub Any suggestion shall be appreciated.
Cheers, siaj
Here is a simple example (the error you got was because you missed the
brackets in the if statement).
<HEAD>
<script language ="javascript" >
var flag = true;
var img = null;
function init()
{
img = document.getElementById("TheImage");
timer = setInterval("TrackFrame()",500);
}
function TrackFrame()
{
if (flag == false)
{
img.src="pic1.jpg";
flag = true;
}
else
{
img.src="pic2.jpg";
flag = false;
}
}
</script>
</HEAD>
<BODY onload="init()">
<img src="pic1.jpg" id="TheImage">
</BODY>
"siaj" <si**@discussions.microsoft.com> wrote in message
news:04**********************************@microsof t.com... Thanks for quick reply... I tried the way u suggested though I had two doubts..
My Javascript code goes as <script language ="javascript" > var flag = true; function init() { alert("I m here!"); timer = setInterval("TrackFrame",500);
} function TrackFrame() { if flag == false { alert("toggling"); flag = true; } else { alert("toggled"); flag = false; }
} </script>
I call from the body as
<body MS_POSITIONING="GridLayout" onload = "init()">
My doubts are that I get an error Expected "(" also If you can tell me how to toggle the image in javascript.
Let me confess that I am a beginner in web development.
Appreciate your help.. Cheers, siaj
"Joseph Byrns" wrote:
You should do it in the JavaScript on the client so:
function init() { timer = setInterval("TrackFrame()",500); }
function TrackFrame() { //toggle image here }
and call the init function from the body.
"siaj" <si**@discussions.microsoft.com> wrote in message news:00**********************************@microsof t.com... > Hello, > I am trying to put a very simple animation on a page. I want two > images > to > show alternately in a defined area. I tried to have an image control > and a > timer control on a page. I am setting the Imageurl property of the > image > control to two difeent images at fixed time interval. but the image > remains > fixed on my page. It never resets to other image. Perhaps I need to > Refresh > the page at every timeinterval. > > My code is as > > > Private Sub Page_Load(ByVal sender As System.Object, ByVal e As > System.EventArgs) Handles MyBase.Load > 'Put user code to initialize the page here > SetTimer() > End Sub > > > Private Sub SetTimer() > Try > AddHandler Timer1.Elapsed, AddressOf OnTimer > Timer1.Enabled = True > Timer1.Interval = 1000 > > Timer1.Start() > Image1.ImageUrl = "C:\Sunset.jpg" > Catch ex As Exception > Response.Write(ex.Message) > End Try > End Sub > > > Public Sub OnTimer(ByVal source As Object, ByVal e As ElapsedEventArgs) > Try > If Image1.ImageUrl = "C:\Sunset.jpg" Then > Image1.ImageUrl = "C:\Winter.jpg" > Else > Image1.ImageUrl = "C:\Sunset.jpg" > End If > > > Catch ex As Exception > Response.write(ex.Message) > End Try > End Sub > > > > Any suggestion shall be appreciated. > > Cheers, > siaj This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics
by: Reid Goldsborough |
last post by:
Hi. I'm a JavaScript neophyte. I'm trying to create a JPEG animation,
with one coin (tet) morphing into another. The code doesn't work.
Anybody feel like taking a shot at correcting me? It's short....
|
by: billrdio |
last post by:
I am trying to make a JavaScript animation of real-time images - i.e.
images that will periodically change on the server. The problem I am
having is that the JavaScript animation I have created is...
|
by: wmschneider |
last post by:
I am trying to make a progress animation so that the user knows that
there files are correctly being checked in. Trying to animate papers
moving from the computer to the server pics. I'm brand...
|
by: jensen bredal |
last post by:
Hello,
I attended a seminar with scott gu. Microsoft asp.net lead guru, and he
mentioned some advanced
javascript that let you display an animation while your page is waiting for
response from...
|
by: quickcur |
last post by:
Hi, I am writing a page where user submits a request and waits for the
response. Since the process takes quite some time on the server side, I
would like to show a small animation immediately after...
|
by: rdemyan via AccessMonster.com |
last post by:
My application has a lot of complicated SQL statements, calculations,
processing that takes time. I've created a custom form to act like a
messagebox. It has 10 small rectangles on it that change...
|
by: Mike |
last post by:
Hi guys,
I'm using this simple code for animation and it's working in an HTML page
like this:
<html><body>
<script language="JavaScript">
var author="www.dseffects.com";
var...
|
by: Mike |
last post by:
Hi Guys,
in some websites I have seen a very good type of animation that consist of
fading between two webpages, where the first webpage fads off and the other
page fads in goto this link to see...
|
by: Sin Jeong-hun |
last post by:
Most applications, including Windows Explorer, show some sort of
'wait' dialog with animation when a lengthy operation is going on. For
example, When the Windows Explorer is searching for...
|
by: CloudSolutions |
last post by:
Introduction:
For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
|
by: Charles Arthur |
last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
|
by: aa123db |
last post by:
Variable and constants
Use var or let for variables and const fror constants.
Var foo ='bar';
Let foo ='bar';const baz ='bar';
Functions
function $name$ ($parameters$) {
}
...
|
by: ryjfgjl |
last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
|
by: ryjfgjl |
last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
|
by: emmanuelkatto |
last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud.
Please let me know.
Thanks!
Emmanuel
|
by: nemocccc |
last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
|
by: Sonnysonu |
last post by:
This is the data of csv file
1 2 3
1 2 3
1 2 3
1 2 3
2 3
2 3
3
the lengths should be different i have to store the data by column-wise with in the specific length.
suppose the i have to...
|
by: Hystou |
last post by:
There are some requirements for setting up RAID:
1. The motherboard and BIOS support RAID configuration.
2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
| |