FrameTest

subroutine FrameTest

**********************************************************************

* FrameTest: Test the ability of FlashConnect to deal with frames

**********************************************************************

include wbp w3include

call w3GetVal(cnt,"cnt")

if cnt='' then

   * Get the User's name

   call w3HtmlInit('simple', "")

   call w3HtmlHeader('','')       ;* Start the page

   call w3HtmlFormBeg("","")      ;* Begin a form

   call w3Print("FrameTest: This program displays lots and lots of frames on your browser.  It's an example of how you can keep track of lots of frames within a FlashConnect program.  Please enter the number of frames you wish to display below.  If the number does not have an integer square root, the closest integer square root will be used.<br><br>")

   call w3Print("How many frames do you want: ")

   call w3HtmlText('cnt','','')

   call w3HtmlSubmit('','OK','')  ;* Add a submit button

   call w3HtmlFormEnd             ;* End the form

   call w3HtmlFooter('','')       ;* End the page

   call w3Input(err,300,'')      ;* Wait 5 minutes for answer

   if err # w3_OK  then return    ;* Timed out, just exit

   call w3GetVal(cnt,"cnt")

end

if not(num(cnt)) or cnt<4 then cnt=4

sqrt_cnt = int(sqrt(cnt))

* Display the frameset

* --------------------

call w3HtmlInit('FrameTest','')

call w3Action( action, '' )

call w3GetVal(w3Cookie, 'w3Cookie')

* Top level frameset begin - the rows

* -----------------------------------

call w3printn('<html><head><title>FlashConnect Frames</title></head>')

out='<frameset rows="75,'

for i = 1 to sqrt_cnt

   out=out:'*,'

next i

out=out[1,len(out)-1]:'">'

call w3printn( out )

* Interior frame sets

* -------------------

out='<frame name="top">'

out = '<frame name="top"'

out:= ' src="':action

out:= '?w3Cookie=':w3Cookie

out:= '&frame=top">'

call w3printn(out)

for i = 1 to sqrt_cnt

   out='<frameset cols="'

   for a = 1 to sqrt_cnt

      out=out:'*,'

   next a

   out=out[1,len(out)-1]:'">'

   call w3printn( out )

   for j = 1 to sqrt_cnt

      x = j'r%2':i'r%2'

      out = '<frame name="':x:'"'

      out:= ' src="':action

      out:= '?w3Cookie=':w3Cookie

      out:= '&frame=':x

      out:= '">'

      call w3printn(out)

   next j

   call w3printn("</frameset>")

next i

call w3printn("</frameset>")

call w3printn("</html>")

* Now loop display stuff in each of the frames

* --------------------------------------------

frames = cnt+1

loop

   call w3Input(err, frames+3, w3InputTrackPageNumberOff)

   if err #w3_OK then exit

   call w3HtmlInit('FrameTest','')

   call w3GetVal(frame, 'frame')

   begin case

   case frame='top'

      call w3print('<html><body><center><h3><b>')

      call w3print('FrameTest')

      call w3print('</b></h3></center></body></html>')

   case 1

      call w3print('<html><body><center>')

      call w3print(frame)

      call w3print('</center></body></html>')

   end case

   frames = frames - 1

while frames do

repeat

return