Before I start coding - is this possible? - Programmers Heaven

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Categories

Welcome to the new platform of Programmer's Heaven! We apologize for the inconvenience caused, if you visited us from a broken link of the previous version. The main reason to move to a new platform is to provide more effective and collaborative experience to you all. Please feel free to experience the new platform and use its exciting features. Contact us for any issue that you need to get clarified. We are more than happy to help you.

Before I start coding - is this possible?

I'm in my first class of asp and we are doing a website project. My friend and I doing a site that plays with words. We want to do a "writer's block" exercise where an image is displayed, the writer writes in a text area, and after a minute, another image displays. I found code to randomly select from a group of pictures:



<%
Randomize
Dim RandomNum, UpperBound, LowerBound
LowerBound = 1 'Put in the first picture #
UpperBound = 10 'Put in the last picture #
RandomNum = Int((UpperBound - LowerBound + 1) * Rnd + LowerBound)
%>
image.jpg">



And I even understand it mostly. I know I need to add a timer somewhere and I'm wondering, if I do, will the whole page need to be refreshed, or will the image just be changed? If the whole page refreshes, then I know I'll need to make sure the text the user has written doesn't get lost. Or, maybe I have to use some client side script? I want to try to do as much server side as possible since that's the class topic, but I also want it to work.

So I'm just trying to figure out how this works logically before I head down a road of code that might be completely off. And please remember, I haven't done any coding until this semester. Thanks so much. Suzy

Comments

  • brownbbrownb Posts: 18Member
    You can use client-side code (Javascript) to perform actions at given time intervals. In this case, since it seems you will want to associate what is typed with the image being displayed, you should put your elements (textarea, hidden imageid(?)) onto a form, then Submit (not refresh or redirect) the form at your desired interval.

    : I'm in my first class of asp and we are doing a website project. My friend and I doing a site that plays with words. We want to do a "writer's block" exercise where an image is displayed, the writer writes in a text area, and after a minute, another image displays. I found code to randomly select from a group of pictures:
    :
    :
    :

    : <%
    : Randomize
    : Dim RandomNum, UpperBound, LowerBound
    : LowerBound = 1 'Put in the first picture #
    : UpperBound = 10 'Put in the last picture #
    : RandomNum = Int((UpperBound - LowerBound + 1) * Rnd + LowerBound)
    : %>
    : image.jpg">
    :

    :
    :
    : And I even understand it mostly. I know I need to add a timer somewhere and I'm wondering, if I do, will the whole page need to be refreshed, or will the image just be changed? If the whole page refreshes, then I know I'll need to make sure the text the user has written doesn't get lost. Or, maybe I have to use some client side script? I want to try to do as much server side as possible since that's the class topic, but I also want it to work.
    :
    : So I'm just trying to figure out how this works logically before I head down a road of code that might be completely off. And please remember, I haven't done any coding until this semester. Thanks so much. Suzy
    :

  • SuzyTallSuzyTall Posts: 9Member
    Well, I want them to be able to keep writing as the images change. How about if with server side script I randomly select 5 images and put them into an array. Then in client side script I have the images shown one at a time and change at one or two minute intervals. Does that logic work? Thanks, Suzy

    : You can use client-side code (Javascript) to perform actions at given time intervals. In this case, since it seems you will want to associate what is typed with the image being displayed, you should put your elements (textarea, hidden imageid(?)) onto a form, then Submit (not refresh or redirect) the form at your desired interval.
    :
    : : I'm in my first class of asp and we are doing a website project. My friend and I doing a site that plays with words. We want to do a "writer's block" exercise where an image is displayed, the writer writes in a text area, and after a minute, another image displays. I found code to randomly select from a group of pictures:
    : :
    : :
    : :

    : : <%
    : : Randomize
    : : Dim RandomNum, UpperBound, LowerBound
    : : LowerBound = 1 'Put in the first picture #
    : : UpperBound = 10 'Put in the last picture #
    : : RandomNum = Int((UpperBound - LowerBound + 1) * Rnd + LowerBound)
    : : %>
    : : image.jpg">
    : :

    : :
    : :
    : : And I even understand it mostly. I know I need to add a timer somewhere and I'm wondering, if I do, will the whole page need to be refreshed, or will the image just be changed? If the whole page refreshes, then I know I'll need to make sure the text the user has written doesn't get lost. Or, maybe I have to use some client side script? I want to try to do as much server side as possible since that's the class topic, but I also want it to work.
    : :
    : : So I'm just trying to figure out how this works logically before I head down a road of code that might be completely off. And please remember, I haven't done any coding until this semester. Thanks so much. Suzy
    : :
    :
    :

  • brownbbrownb Posts: 18Member
    Logic is fine, but then barely need server-side script at all unless the images are physically stored in a server-side database. If retrieving links from database (to images stored on ure web server, for example), might be better (know this is not in the spirit of ure class) to do the entire thing in Javascript, and use ASP to process the submitted page.

    : Well, I want them to be able to keep writing as the images change. How about if with server side script I randomly select 5 images and put them into an array. Then in client side script I have the images shown one at a time and change at one or two minute intervals. Does that logic work? Thanks, Suzy
    :
    : : You can use client-side code (Javascript) to perform actions at given time intervals. In this case, since it seems you will want to associate what is typed with the image being displayed, you should put your elements (textarea, hidden imageid(?)) onto a form, then Submit (not refresh or redirect) the form at your desired interval.
    : :
    : : : I'm in my first class of asp and we are doing a website project. My friend and I doing a site that plays with words. We want to do a "writer's block" exercise where an image is displayed, the writer writes in a text area, and after a minute, another image displays. I found code to randomly select from a group of pictures:
    : : :
    : : :
    : : :

    : : : <%
    : : : Randomize
    : : : Dim RandomNum, UpperBound, LowerBound
    : : : LowerBound = 1 'Put in the first picture #
    : : : UpperBound = 10 'Put in the last picture #
    : : : RandomNum = Int((UpperBound - LowerBound + 1) * Rnd + LowerBound)
    : : : %>
    : : : image.jpg">
    : : :

    : : :
    : : :
    : : : And I even understand it mostly. I know I need to add a timer somewhere and I'm wondering, if I do, will the whole page need to be refreshed, or will the image just be changed? If the whole page refreshes, then I know I'll need to make sure the text the user has written doesn't get lost. Or, maybe I have to use some client side script? I want to try to do as much server side as possible since that's the class topic, but I also want it to work.
    : : :
    : : : So I'm just trying to figure out how this works logically before I head down a road of code that might be completely off. And please remember, I haven't done any coding until this semester. Thanks so much. Suzy
    : : :
    : :
    : :
    :
    :

  • CuberootCuberoot Posts: 1Member
    Since your considering preloading the images into an array, how about just combining the images into 1 animated image that rotates from image to time each minute. This would eliminate all client side scripting.

    Edward L. Ries
    [email protected]
Sign In or Register to comment.