Google Answers Logo
View Question
 
Q: HTML, Java, or ?, Script for rapidy flipping through web addresses. ( No Answer,   5 Comments )
Question  
Subject: HTML, Java, or ?, Script for rapidy flipping through web addresses.
Category: Computers > Programming
Asked by: johnjri1-ga
List Price: $3.00
Posted: 04 Apr 2005 19:21 PDT
Expires: 04 May 2005 19:21 PDT
Question ID: 504999
I Would like a link to a free working script that can treat columns of
several hundred web adresses as a slide show, preferebly at a fairly
quick pace, with forward, reverse, and stop.  Faster and slower would
be nice,,, but now I'm asking to much, hehe.

Example of the data sets I have.
http://www.website1.com
http://www.website2.com
http://www.website3.com
etc.
etc.
http://www.website500.com

I'm open to creative solutions.  I have a very basic understanding of HTML.

John

Clarification of Question by johnjri1-ga on 05 Apr 2005 09:23 PDT
willcodeforfood

That looks great, I'm rushing out on errands so I can't elaborate, but
sufice to say that the bottom frame was getting "the page cannot be
displayed".  I probably maid a little mistake somewhere (naming the
file/path).  I should have emphasized, I have *very little HTML
experience but I'll figure it out tonight.

Pages busting out of frames will not be a problem for my original
intended purpose.  I'll post another question if it becomes an issue.

Regards,
John

Clarification of Question by johnjri1-ga on 05 Apr 2005 19:44 PDT
willcodeforfood,

"Make sure to put both files in the same folder."  
Yes they are.

"You can name the first file anything you want but the second file has
to be named control.htm ..."
It is named control.html

The funny thing I can't figure out is when I right click/properties on
the bottom frame where the control.html is suposed to be, I get this
incorect path:
res://C:\WINNT\system32\shdoclc.dll/dnserror.htm#file://C:\Documents
and Settings\Administrator\Desktop\slideshow\control.htm

It is on my desktop, and in a folder named slideshow, so the
properties seems partly correct, but not all corect.  The path shown
in properties should be:
C:\Documents and Settings\Administrator\Desktop\slideshow\control.htm

I'm not sure why it's doing that.

If I right click on the file in the folder the path I get is:
C:\Documents and Settings\Administrator\Desktop\slideshow\control.htm

.

John

Clarification of Question by johnjri1-ga on 05 Apr 2005 20:17 PDT
willcodeforfood,

I got it!  I copied and pasted again, but this time with wordpad
instead of notepad. Maybe I made a mistake, or maybe wordpad instead
of notepad was the problem, not sure.  Anyway I'm very pleased, real
nice little script! This will make this endeavor much easier!  Please
consider the question answered, and Thanks. :)

Regards,
John

Clarification of Question by johnjri1-ga on 07 Apr 2005 10:16 PDT
Someone find willcodeforfood, and tell him to post his answer so he
can get paid.  Maybe he has a couple days off?

Clarification of Question by johnjri1-ga on 09 Apr 2005 19:08 PDT
willcodeforfood,  shoot me an e-mail me at john-os@excite.com.  I've
got a 'thankyou' for you via paypal.

Please put "GOOGLE ANSWERS" all caps in the Subject line so I wont think it's spam.

Regards, 
John
Answer  
There is no answer at this time.

Comments  
Subject: Re: HTML, Java, or ?, Script for rapidy flipping through web addresses.
From: xarqi-ga on 04 Apr 2005 21:18 PDT
 
yeah - it can be done quite easily I think.
Set up a web page with two frames.  One contains the list of web pages
and the buttons and speed parameters to control the action; the other
is where the page will be displayed.
Click "start", and a javascript runs that sequentially fetches
addresses from th elist and displays them in the other frame.  It then
waits for a period specified in another control field in the first
frame, and then gets the next one.  The script can check to see if a
"stop" button has been pressed, and stop if it has.  You can have next
and previous buttons that move forwards and bacwards in the list.

Overall maximum speed will depend on your internet connection, unless
you store copies of all of the pages locally.

Somebody else can probably fill in the details here, but this should
be a feasible approach.
Subject: Re: HTML, Java, or ?, Script for rapidy flipping through web addresses.
From: willcodeforfood-ga on 05 Apr 2005 00:32 PDT
 
You can create a webpage slideshow using JavaScript.  The one problem
is that if you are navigating to external websites, they may well
redirect the browser so that their site is the _top URL.  This
happens, for example, whenever you visit the nytimes.com website. 
This script will not get your slideshow to pass such a site but will
instead get "stuck" on that URL.  This could be overcome by writing an
application with an embedded Explorer window (control) or writing a
browser helper object for IE.  Neither would be trivial, but I can
help you get you a good start if you need to go to such lengths.

On to the example though.  You'll need to make two HTML files to get
this example working.  I tried to keep it all pretty simple, but some
of the features required a bit more code.  Start by making a file
called main.htm and then paste in this HTML (note where to add your
URLs in place of the ones I tested):

<html>
<head>
<title>URL Slideshow</title>
<script>
  var frameIdx;
  var frameUrl = new Array();
  frameUrl[0] = "about:blank";
  frameUrl[1] = "http://www.cnn.com";
  frameUrl[2] = "http://www.espn.com";
  frameUrl[3] = "://www.google.com";
  frameUrl[4] = "http://www.msn.com";
  frameUrl[5] = "http://www.yahoo.com";
  // Add more URLs here.                        <-- LOOK HERE ! ! !
  // Just give each subsequent entry
  //   the next higher number.
  // Do not skip numbers.
  function show()
  {
    document.frames("fmeMain").location.href = frameUrl[frameIdx];
  }
  function first() { frameIdx=0; show(); }
  function last() { frameIdx=frameUrl.length-1; show(); }
  function next()
  {
    if (frameIdx<frameUrl.length-1)   
    {
      frameIdx++;
      show();
    }
    return (frameIdx==frameUrl.length-1)
  }
  function prev()
  {
    if (frameIdx>0)   
    {
      frameIdx--;
      show();
    }
    return (frameIdx==0);
  }
  setTimeout("first()",1)
</script>
</head>
<frameset rows="*,30" cols="*">
  <frame id="fmeMain" src="about:blank">
  <frame id="control" src="control.htm"></frame>
</frameset>
</html>


Now make a file called control.htm and paste in this HTML:

<html>
<head>
  <style>
    button {font-weight:bold ; width:40px}
  </style>
  <script>
  var framePause = true;
  var playDir = 0;
  function play(inc)
  {
    playDir = inc;
    framePause=false;
    document.getElementById("cmdPlay").disabled=true;
    document.getElementById("cmdReverse").disabled=true;
    document.getElementById("cmdPause").disabled=false;
    document.getElementById("cmdPrev").disabled=true;
    document.getElementById("cmdNext").disabled=true;
    document.getElementById("cmdFirst").disabled=true;
    document.getElementById("cmdLast").disabled=true;
    var stat = document.getElementById("cmdStatus");
    stat.innerText = (playDir==1 ? "Forward" : "Reverse");
    auto();
  }
  function pause()
  {
    framePause=true;
    document.getElementById("cmdPlay").disabled=false;
    document.getElementById("cmdReverse").disabled=false;
    document.getElementById("cmdPause").disabled=true;
    document.getElementById("cmdPrev").disabled=false;
    document.getElementById("cmdNext").disabled=false;    
    document.getElementById("cmdFirst").disabled=false;
    document.getElementById("cmdLast").disabled=false;
    document.getElementById("cmdStatus").innerText = "Paused";
  }
  function next()
  {
    var end = parent.next()
    if (end)
    {
      document.getElementById("cmdNext").disabled=true;    
      document.getElementById("cmdLast").disabled=true;
      if (!document.getElementById("cmdLoop").checked)
      {
        document.getElementById("cmdPause").disabled=true;
        document.getElementById("cmdStatus").innerText = "Paused";
        framePause=true;
      }
    }
    if (framePause)
    {
      document.getElementById("cmdPrev").disabled=false;
      document.getElementById("cmdFirst").disabled=false;
      document.getElementById("cmdReverse").disabled=false;
    }
    return end;
  }
  function prev()
  {
    var end = parent.prev()
    if (end)
    {
      document.getElementById("cmdPrev").disabled=true;    
      document.getElementById("cmdFirst").disabled=true;
      if (!document.getElementById("cmdLoop").checked)
      {
        document.getElementById("cmdPause").disabled=true;
        document.getElementById("cmdStatus").innerText = "Paused";
        framePause=true;
      }
    }
    if (framePause)
    {
      document.getElementById("cmdNext").disabled=false;    
      document.getElementById("cmdLast").disabled=false;
      document.getElementById("cmdPlay").disabled=false;
    }
    return end;
  }
  function first()
  {
    document.getElementById("cmdPrev").disabled=true;    
    document.getElementById("cmdFirst").disabled=true;
    parent.first()
    document.getElementById("cmdNext").disabled=false;    
    document.getElementById("cmdLast").disabled=false;
    document.getElementById("cmdPlay").disabled=false;
  }
  function last()
  {
    document.getElementById("cmdNext").disabled=true;    
    document.getElementById("cmdLast").disabled=true;
    parent.last()
    document.getElementById("cmdPrev").disabled=false;
    document.getElementById("cmdFirst").disabled=false;
    document.getElementById("cmdReverse").disabled=false;
  }
  function auto()
  {
    if (framePause)
      return;
    var end;
    if (playDir==1)
      end = next();
    else
      end = prev();
    if (end)
    {
      if (playDir==1)
        setTimeout("autofirst();", waitsecs());
      else
        setTimeout("autolast();", waitsecs());
    }
    else
      setTimeout("auto()", waitsecs());
  }
  function autofirst()
  {
    if (framePause)
      return;
    parent.first();
    setTimeout("if (!framePause) play(1)", waitsecs())
  }
  function autolast()
  {
    if (framePause)
      return;
    parent.last();
    setTimeout("if (!framePause) play(-1)", waitsecs())
  }
  function waitsecs()
  {
    var w = new Number(document.getElementById("cmdSeconds").value);
    if (w.isNaN)
    {
      document.getElementById("cmdSeconds").value = 10
      w = new Number(10);
    }
    return w*1000;
  }
  </script>
</head>
<body style="background-color:gainsboro ; margin:2px; font-family:arial">
  <nobr>
  <button id="cmdFirst" onClick="first()" disabled>&lt&lt&lt</button>
  <button id="cmdLast" onClick="last()">&gt&gt&gt</button>
  &nbsp;&nbsp;
  <button id="cmdPrev" onClick="prev()" disabled>&lt&lt</button>
  <button id="cmdNext" onClick="next()">&gt&gt</button>
  &nbsp;&nbsp;
  <button id="cmdReverse" onClick="play(-1)">&lt</button>
  <button id="cmdPause" onClick="pause()" disabled>||</button>
  <button id="cmdPlay" onClick="play(1)">&gt</button>
  &nbsp;&nbsp;
  <input id="cmdLoop" type="checkbox">Loop
  &nbsp;&nbsp;
  wait<input id="cmdSeconds" size="3" value="10">seconds
  &nbsp;&nbsp;
  Status: <span id="cmdStatus" style="font-weight:bold">Paused</span>
  </nobr>
</body>
</html>
Subject: Re: HTML, Java, or ?, Script for rapidy flipping through web addresses.
From: willcodeforfood-ga on 05 Apr 2005 10:07 PDT
 
Make sure to put both files in the same folder.  You can name the
first file anything you want but the second file has to be named
control.htm because this part of the first file:

<frame id="control" src="control.htm"></frame>

references it by name.
Subject: Re: HTML, Java, or ?, Script for rapidy flipping through web addresses.
From: xarqi-ga on 07 Apr 2005 18:39 PDT
 
willcodeforfood can't actually post a formal answer as he/she is not
one of the annointed ga-researchers.  I must say, it was a splendid
voluntary effort on his/her part.
Subject: Re: HTML, Java, or ?, Script for rapidy flipping through web addresses.
From: willcodeforfood-ga on 10 Apr 2005 19:44 PDT
 
Yes, it's me...  I'm glad the script worked out for you.

Important Disclaimer: Answers and comments provided on Google Answers are general information, and are not intended to substitute for informed professional medical, psychiatric, psychological, tax, legal, investment, accounting, or other professional advice. Google does not endorse, and expressly disclaims liability for any product, manufacturer, distributor, service or service provider mentioned or any opinion expressed in answers or comments. Please read carefully the Google Answers Terms of Service.

If you feel that you have found inappropriate content, please let us know by emailing us at answers-support@google.com with the question ID listed above. Thank you.
Search Google Answers for
Google Answers  


Google Home - Answers FAQ - Terms of Service - Privacy Policy