Jump to content

optikalefx

Members
  • Posts

    363
  • Joined

  • Last visited

    Never

Posts posted by optikalefx

  1. set firefox to open new windows as tabs

     

    set a global counter var

    var counter = 0;

     

    then use javascript to setTimeout('openPage()',60000);

     

    then the function

    function openPage() {

      window.open(myArray[counter]);

    counter ++;

    }

     

    now just wrap this all in a for loop.

     

    for (var i=0;i<=myArray.length;i++) {

      // do the timeout here

    }

     

     

    You could also not have the global counter, and pass in the index of i as you loop. (probably more efficient)

  2. so using jQuery give each select box an attribute called div and make that equal to the ID of the box to hide

    <select div='mydiv' onchange="myFunction(this)";>

    <div id='mydiv'></div>

     

    function myFunction(this) {

      var which = $(this).attr("div");

      $("#"+which).hide();

    }

     

    something like that.  just be clever with attributes.

  3. if($("#door").style.top=="0px"){

     

    does not evaluate.  .style.top is a property of a DOM object.  But $("#door") returns a jQuery object, not a DOM object.

    Either use jquery $("#door").css("top")  or use $("#door").get().style.top to evaluate.

  4. Yes there is a way to easily do this

     

    go to google and type in MDC Selection

     

    anchorNode

    anchorOffset

    focusNode

    focusOffset

     

    You can use these 4 properties of the window.selection (even if there is no selection) and work it out that way.  I don't remember exactly but i did this before and it worked.

     

    Maybe also take a look at MDC Range

  5. no prob dude.

     

    I totally agree with learning without jquery first.

     

    So Ill give you the parts and you can put them together.

     

    I already gave you the html and css in the last post.  The idea here again, is to fit 2 images on top of eachother.

     

    The next part is creating an interval

     

    myInterval = setInterval('dofade()',20);  // dont use var myInterval

     

    then in function dofade() {

        // get a reference to the image on top using document.getElementById("idofimg");

      // change its object.style.opacity -= .1;

      // add some if statment to make sure it  stops at 0

      // when it gets to 0, use clearInterval(myInterval);

    }

     

    So when you call that interval it will fade out the first image, and since the first image is already on top of the 2nd one, the 2nd one will look like its fading in.

     

    Of course you can make a 2nd interval, or even add more into the function, that fades the bottom in as the top one goes out.  Just keep in mind the more work you make the browser do the slower and choppier it is.

     

    Good luck man!  Post back if you have any questions.  If you can't get it, hit me up on youtube and ill make a video of me fixing it.  youtube.com/optikalefxx

  6. my first question would be, why not use jquery.

     

    My answer would then, be you need to make a function that does what jquery fade does.  Basically a setInterval timer that changes the opacity over time.  The key here is that you need the parent element relative position. and the two images absolute, with z-indexes set.

     

    <div style='position:relative'>

    <img style='position:absolute;top:0px;left:0px'>

    <img style='position:absolute;top:0px;left:0px'>

    </div>

     

    this way the images are on top of eachother.  Now fade one out and the other will show.

     

  7. So the way I looked at it, If i have a set of common data that will share common functions that the rest of the code won't use.  And I have the intent of REusing this (object) then, an object should be used.

     

    For example, I made a paypal buyer object.  All the buyer information is related, and there are a few functions that pay requires so that the buyer information is correct.  But no where else in the code are those functions needed.  So an objected seemed the right choice.

  8. Can someone explain to me why I should use OOP instead of procedure based code.

     

    Im building a shopping cart and i created and Item object already and using it to hold data for each item.  But this Object just has properties.  I mean what methods could there possibly be for an item.

     

    Why would I need a Cart object either?  There will never be more than 1 instance of the cart running.  So what are the advantages to putting all my functions inside of a class?

     

    Thanks, and sorry if your offended by this, im trying to go OOP i just don't see why yet.

  9. I have this overlay where it greys out the screen and there is HTML in there.

     

    I have an input box, but in IE i can't really click it.  I mean i can click something around it, and the cursor shows up, but nothing comes up in the box when i type.  What quirk do i have to fix for IE that allows me to type in input boxes that float on top of the screen in a fixed position

  10. Thanks! I didn't know you could set your own session folder.  This is also a great way to test that I'm getting all my required information.

     

    The php.ini file says I have to do my garbage cleaning with a cron job.  Do I really have to do that or will it do that when i destroy the session?

  11. I have session_start() at the top of every page.  For some reason if I wait for more than a minute on any page, when I go to refresh the page it kicks me out. I have specific code that tests for a certain session variable, if it doesn't find it, then it kicks the user out.  So why does waiting expire the session?  If i just wait 30 seconds or so and refresh it works fine, but if i wait 2 or 3 minutes then when i refresh the session variable im checking for is gone.

     

    I checked the PHPSESSID and there is no expiration on the cookie.

  12. Im beating my head against a wall here.

     

    I am looping to form a sql string and this is the result of that

     

    'INSERT INTO cal (company,type,corpParent,hasAflac,anotherAgent,hasHR,contact,position,decision,phone,email,fax,address,adrConf,benefits,totalEmps,fullTimeEmps,notes,whoSet,setDate,time) VALUES (\'wef\',\'wefwefwef\',\'1\',\'1\',\'1\',\'1\',\'qwefqwef\',\'qwefqwef\',\'1\',\'qwefqwef\',\'qwefqwfw\',\'qwefqwef\',\'qwefqwef\',\'1\',\'Health insurance\',\'qwefqwf\',\'qwefqw\',\'qwefqwef\',\'1\',\'1247861162\',\'1247736180\')'

     

     

    You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near ''INSERT INTO cal (company,type,corpParent,hasAflac,anotherAgent,hasHR,contact,po' at line 1

     

    I put that EXACT sql statement into PHPmyAdmin and it works!  So i have no idea what's going on.  I test a SELECT to make sure the db was connected and it is.  I tried with double quotes and not escaping and that that didn't work, i tried using the SET syntax and taht didn't work.  WTF am I doing wrong?

     

    Thanks! :confused: :confused:

  13. when you install a firefox extension the browser restarts.  When that happens my extension pulls up a webpage that says thanks for downloading.  Well that user had a session, and i want to subtract a counter from the database but i cant refer to that person unless i know who got to that page.

     

    I solved it by setting a cookie that way when i restart just read the cookie and then get the database info that way.

  14. So my entrie session uses the normal PHPSESSID cookie.  I need that to last past the browser closing.  How do i change the expiration of that cookie.  Ive tried everything and i just get php errors or it doesnt set the cookie.  Whats the right way to do it?

     

    Thanks.

  15. This is really bothering me.  I think I don't know something about sessions.

    I have 5 php pages and a login php file.  When you login it creates a session and stores 3 variables. first name last name and both together

     

    part of login.php

    if ($emailFound) {
    if ($passFound) {
    	session_start();
    	$res = mysql_query("SELECT * FROM customerInfo WHERE email = '$email'") or die(mysql_error());  
    	while($row = mysql_fetch_array( $res )) {
    		$_SESSION['fName'] = $row['fName'];
    		$_SESSION['lName'] = $row['lName'];
    		$_SESSION['name'] = $_SESSION['fName'] . " " .$_SESSION['lName'];
    	}
    	header("Location: index.php");
    } else header("Location: login.php?err=".WRONGPASS);
    } else header("Location: login.php?err=".EMAIL);
    

     

    Then on ever page I have at the very very top included a file called session.php

     

    at the top of every viewable page

    <?PHP include('session.php');?>
    

     

    contents of session.php

    <?PHP
    if( isset( $_COOKIE['PHPSESSID'] ) ) {
    session_start();
    $name = $_SESSION['name'];
    $lgn = "Welcome back ".$name."<br><a id='namez' href='http://www.mysite.com/logout.php'>Not ".$name."?</a>";
    } else {
    $lgn = "<a id='namez' href='http://www.mysite.com/login.php'>Login</a>";
    }
    
    ?>
    

     

    And then later on i include a file that displays the info from the session

    <?PHP include('top.php');?>
    

     

    and inside of that file

    <div id="namez"><?=$lgn?></div>
    

     

    It works just fine for /index.php /page1.php and /page2.php

    but it fails for /dir/page.php and /dir/page2.php

    Even though those includes are both

    <?PHP include('../session.php');?>
    //and
    <?PHP include('../top.php');?>
    

     

    The issue is that with the pages that are a directory deep, the SOMETIMES work.  And its not always the same ones.  So i cant draw a conclusion as to why this is happening.  if they were always not working, ok i can fix it.  But they are sometimes working.

     

    MOREOVER, its passing the isset for the cookie just fine on every page everytime.  Its just forgetting the $_SESSION['name'] variable at times.  Sometimes its there, sometimes it just says "Weclome back, Not ?"

     

    Any ideas what Im missing in all this? Thanks

     

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.