Re: Rotate HTML code-such a thing?

by "Marc David Johnson" <mjohnson(at)marcdavidjohnson.com>

 Date:  Thu, 2 Aug 2001 12:22:24 -0400
 To:  "Jim O'Brien" <JObrien(at)witness.com>
 Cc:  <hwg-techniques(at)hwg.org>
 References:  witsys
  todo: View Thread, Original
You are correct, I have had a prior conversation with Virginia and know that
at least one of the advertisers she'll be using employs rich media code
(JavaScript) which is why I did this in ASP.

Basic rotation (of a link and an associated image) is easy to do in almost
any scripting environment (ASP, JavaScript, CGI, Perl, etc.) but rotation of
a block of code, that employs JavaScript as part of that code, is a bit
trickier (but can be accomplished with ASP at least as shown below - and
probably done with other technologies as well). :-)

Marc David Johnson
mjohnson(at)marcdavidjohnson.com
http://www.MarcDavidJohnson.com
A little bit of everything ... and a whole lot of nothing.
http://mdj.inc <--- New.net address (info - v)
(http://www.qksrv.net/click-714870-1933347)

----- Original Message -----
From: "Jim O'Brien" <JObrien(at)witness.com>
To: "'Marc David Johnson'" <mjohnson(at)marcdavidjohnson.com>
Cc: <hwg-techniques(at)hwg.org>
Sent: Thursday, August 02, 2001 12:16 PM
Subject: RE: Rotate HTML code-such a thing?


> ahhh....  now we're adding/talking about functionality/constraints that
> weren't origninally discussed or asked for...  it's just a very simple
> JavaScript that takes random images of the same size and rotates them on a
> predetermined rate of time and each image has it on link associated with
it
> as well....  for that matter there is a similar script that can be done
with
> CGI....
>
> http://www.js-x.com
> http://www.xs4all.nl/~ppk/js/
> http://javascript.internet.com/
>
>
>
>
> -----Original Message-----
> From: Marc David Johnson [mailto:mjohnson(at)marcdavidjohnson.com]
> Sent: Thursday, August 02, 2001 12:08
> To: Jim O'Brien
> Cc: hwg-techniques(at)hwg.org
> Subject: Re: Rotate HTML code-such a thing?
>
>
> Only problem I've found is that JavaScript doesn't like to have more
> JavaScript code within it's variables (which most rich media ads use). The
> processing of the page loads the variables and writes them out but then it
> doesn't process the embedded JavaScript.
>
> Perhaps the samples I've seen weren't very good. Know any good links to do
> this with JavaScript (if so, I'd appreciate it as I'd love to give people
> 'options' when writing this article <grin>).
>
> Thanks ;-)
>
> Marc David Johnson
> mjohnson(at)marcdavidjohnson.com
> http://www.MarcDavidJohnson.com
> A little bit of everything ... and a whole lot of nothing.
> http://mdj.inc <--- New.net address (info - v)
> (http://www.qksrv.net/click-714870-1933347)
>
> ----- Original Message -----
> From: "Jim O'Brien" <JObrien(at)witness.com>
> To: "'Marc David Johnson'" <mjohnson(at)marcdavidjohnson.com>
> Cc: <hwg-techniques(at)hwg.org>
> Sent: Thursday, August 02, 2001 12:02 PM
> Subject: RE: Rotate HTML code-such a thing?
>
>
> > .asp does make things fairly straightforward...  if we really wanted to
> make
> > things SUPER simple... we'd just use plain JavaScript.  The script is
> super
> > easy and you can find it for free at most good JavaScript web sites....
> >
> >
> >
> > -----Original Message-----
> > From: Marc David Johnson [mailto:mjohnson(at)marcdavidjohnson.com]
> > Sent: Thursday, August 02, 2001 11:59
> > To: Jim O'Brien; 'L.T. Harris'
> > Cc: hwg-techniques(at)hwg.org
> > Subject: Re: Rotate HTML code-such a thing?
> >
> >
> > Have been reading this post and communicating with Virginia.
> >
> > IF the server supports ASP and IF the client is willing to rename the
> pages
> > to utilize ASP (changing from .html pages to .asp) it is very simple to
do
> > banner rotation (or any kind for that matter).
> >
> > In the Global.asa file on the webserver add:
> > ------------
> > Sub Application_OnStart
> >
> > Dim objFSO, objTextFile
> > Set objFSO = CreateObject("Scripting.FileSystemObject")
> > Set objTextFile = objFSO.OpenTextFile(Server.MapPath("banner1.txt"))
> > Do While Not objTextFile.AtEndOfStream
> >  Application("ban1") = objTextFile.ReadAll
> > Loop
> > objTextFile.Close
> > Set objTextFile = objFSO.OpenTextFile(Server.MapPath("banner2.txt"))
> > Do While Not objTextFile.AtEndOfStream
> >  Application("ban2") = objTextFile.ReadAll
> > Loop
> > objTextFile.Close
> > Set objTextFile = Nothing
> > Set objFSO = Nothing
> > End Sub
> > -------------
> >
> > This loads information from two text files (banner1.txt and banner2.txt
> > located in the web root directory) when the application first starts
(you
> > could write a quick check to throw in Session_OnStart to reload these
> files
> > IF a certain criteria is matched if you desired) and stores the values
in
> > Application level variables (called ban1 and ban2).
> >
> > Then, on the .asp page you want to display the ads on, insert the
> following
> > code where you want the ad to appear:
> > -------------
> > <%
> > randomize
> > DispNum = int(rnd*2)+1
> > response.write(Application("ban" & DispNum))
> > %>
> > -------------
> >
> > That's it. This will randomly choose one of the two banners and write
out
> > the code on the page for it. If you want more banners, copy the 5 lines
in
> > Global.asa (from Set ... through .Close) and rename the files to
> banner3.txt
> > and variable to ban3, etc. -- and on the web pages, (Rnd*2), becomes
> (Rnd*3)
> > which would rotate among 3 banners.
> >
> > This is a very simple example of an article I am currently working on to
> > rotate rich media advertising via ASP. If you'd like to know when it is
> > published, contact me off-list and I'll keep you informed. :-)
> >
> > Hope that helps and let me know if you have any questions,
> >
> > Marc David Johnson
> > mjohnson(at)marcdavidjohnson.com
> > http://www.MarcDavidJohnson.com
> > A little bit of everything ... and a whole lot of nothing.
> > http://mdj.inc <--- New.net address (info - v)
> > (http://www.qksrv.net/click-714870-1933347)
> >
> >
>

HWG hwg-techniques mailing list archives, maintained by Webmasters @ IWA