onLoad

Discussion in 'HTML Development' started by cyberdyne, Aug 24, 2005.

  1. cyberdyne Member

    Hi all,
    Is it possible to use the onLoad function, ie:
    Code:
     
    [color=black]<body onLoad="alert('Caution!!! );">[/color] 
     
    As an enter / dont enter option?

    ie: Click OK and you enter the site, Click No and you're redirected?

    Thank you
  2. Jack HU Moderator

    I Beleive this is what you need.

    in the head put the following:

    Code:
    <script = javascript>
    
    function Caution()
    {
       alert("Caution!!!");
    }
    
    </script>
    
    in the body tag:

    Code:
    <BODY onload="Caution()">
    This is only an "OK" box however, not sure about yes/no ;)

    hope this helps a bit


    Jack
  3. cyberdyne Member

    Thanks Jack, thats roughly what i have now, but i need an option to enter or leave if possible.
    Thanks :)
  4. Jack HU Moderator

    I'll look into it :D
  5. cyberdyne Member

    Thanks Jack, think i have it:

    Code:
    onclick="javascript:return confirm('Continue ?')"
    
    Testing now.

    EDIT:
    ====
    Code:
    on[color=red]load[/color]="javascript:return confirm('Continue ?')"  
    
    .....of course

    But cancel doesnt revert away from the page unfortunately, it still loads.
    Hm....

    This is the sort of thing i was hoping for, but wondered if i could get this to activate with the onload function so that its the first thig the user sees and has the choice to continue or exit:
    Code:
    <form action="1.php" method="post">
    <div><input type="submit" name="accept" value="Agree - Continue" /></div>
    </form>
    <br>
    <form action="" name="do not accept">
    <input type=button name="do not accept" value="Disagree - Exit" onClick="javascript:window.close();">
     </form>
  6. Bob I think, it hurts, I stop

    Why not just have a 'cover page'?
  7. cyberdyne Member

    Blogger.com doesnt allow it. All content is written on one page.

Share This Page