Flash Games

 FAQ   Search   Members   Groups   User Control Panel      Login 

It is currently Thu Jan 08, 2009 1:45 am

All times are UTC + 1 hour




Post new topic Reply to topic  [ 3 posts ] 
Author Message
 Post subject: setInterval IE
PostPosted: Sun May 25, 2008 7:05 am 
Offline

Joined: Sun May 25, 2008 6:44 am
Posts: 6
hi,
it was quite uncanny visiting this site for the first time and being welcomed by your scrolling login,

i am at the moment trying to put together something similar,
the site I am building is an admistrative site for gun-licencing operators consisting of various elaborate forms to fill in for merging to various licencing applications, because some of the forms are really long, i had to add save and edit buttons at regular intervals, but I had seen a divider that scrolls with the page somewhere before, and decided I was going to try to script one myself, so that i could have the save/edit buttons run alongside the form,
so the story goes...
basically to set up the scrolling div wasnt too complicated until I checked it out in my IE6 browser basically setInterval wasn't working so well,actually it only passed once and stopped,after a frustrating search on the topic, my end call looked something like this
Code:
<?php
$intval = (int)0;
echo "<script language='javascript'>setInterval(\"slidediv()\",".$intval.");</script>";
?>

I eventually scrapped this, as IE6 just wasn't having fun,
I did decide on alternative solution which I think will work ok, but would like some advice on the above topic and perhaps on my solution,

basically what I have done instead is to call setTimeout, and I call my function that I was calling with setInterval,
but I made it into a recursive function with an option to abort as well, so it just keeps doin its job until it gets told to stop, which is perfect because I don't really need a delay on my scrolling div.

..in hindsight and as i am just busy thinking, perhaps, because IE6 at least reads setInterval once I could add setInterval as the recursive call, but that might actually do some nasty things if i think about it, a recursive setInterval that doesnt stop recursing on itself,eeek,

anyway any advice on getting setInterval working on IE6 most appreciated.


Top
 Profile  
 
 Post subject:
PostPosted: Sun May 25, 2008 7:26 am 
Offline

Joined: Sun May 25, 2008 6:44 am
Posts: 6
i take that back, a recursive function aint goin to work, memory runs out,he,he,going to have to work onthis a bit more,aargh, me thinks two functions might do the trick, gonna go give that a bash.


Top
 Profile  
 
 Post subject: solved after a nap
PostPosted: Sun May 25, 2008 4:46 pm 
Offline

Joined: Sun May 25, 2008 6:44 am
Posts: 6
finally i solved my problem,

i eventually stripped the problem down to its essentials, a basic call to setInterval and the bare minimum in the function,
that is when i realised the problem,

basically my function polls for the innerHTML value of a divider,
the first creation of this divider was sitting up in my php code, and for some reason the setInterval was firing before it had been created and thus any call to the 'non-existent' div was giving an error,

so what i did was this (simplified):

Code:
if(isset($_POST['rsa']))
{

  echo "<div id='slidmen' style='display:none;position:absolute; z-index:800;top:530px;left:0px;width:150px;height:170px;background:#000;color:#fff;'>held</div>";
  echo "<div id='tog' style='display:none;'>noshow</div>";

    $intval = (int)1000;
    echo "<script type='text/javascript' language='javascript'>setInterval(\"polldiv(\'slidemen\')\",".$intval.");</script>";
}


so that i force php to create the divider before calling setInterval,
also, I moved all of this to the bottom of the page, for some reason that helps too,

from here on in i can manipulate the divs innerHTML with other events, and the polling function will do the relative task.
and for anybody interest here is the code for the scroller,you might want to change the interval;
Code:
function polldiv(wot){

  var data = document.getElementById('tog');
    // alert('hello');

  if(data.innerHTML == "noshow" )
  {


  }
  else
  {
       if(navigator.appName == "Microsoft Internet Explorer")
       {
           var pp = document.body.scrollTop;
       }
       else
       {
            var pp = window.pageYOffset;
       }

       var menu = document.getElementById('slidmen');
       menu.style.display = 'block';
      if(pp > 530)
       {
        var npos = (pp)+"px";
        menu.style.top = npos;
       }
       
       
        //change data.innerHTML somewhere else to perform relative tasks
        //handy if you want a scrolling menu is specific to the page content
       if(data.innerHTML == "showprev" )
       {
          menu.innerHTML = "Welcome to my innerworld";
       }
       else
       {
          menu.innerHTML = "Welcome to my outerworld";
       }
       
}


now what i want to work on is create a delayed slide effect between old position and new position.Any advice?


Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 3 posts ] 

All times are UTC + 1 hour


Who is online

Users browsing this forum: No registered users and 20 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group - Flash Games - TNX Invitation Code - TNX Review

Welcome to DEVPPL.com
You are not logged in, which means that you can't post in the forums.
Click here to Register

If you are a current member here on DEVPPL, please login below:

User:
Pass:
Log me on automatically each visit: