Register

If this is your first visit, please click the Sign Up now button to begin the process of creating your account so you can begin posting on our forums! The Sign Up process will only take up about a minute of two of your time.

Results 1 to 1 of 1

Thread: PopUp Help

  1. #1
    Junior Member
    Join Date
    Sep 2008
    Posts
    1
    Member #
    17355
    How would i make a pop up with one of three randomly generated messages. I dont want this pop up to show in a new window.

    This is what I have so far.

    <SCRIPT language="JavaScript">
    function get_random()
    {
    var ranNum= Math.floor(Math.random()*3);
    return ranNum;
    }

    function getaQuote()
    {
    var whichQuote=get_random();
    var contents = '<html><head><title>Counter Window<\/title></head></html>';
    var quote=new Array(3)
    quote[0]="Switch to Firefox for a safer, more customizable web experience.";
    quote[1]="Don't forget to sign the guestbook!";
    quote[2]="Don't forget to vote in the weekly poll!";

    alert(quote[whichQuote]);
    }

    getaQuote()
    </SCRIPT>


    I found this code on the internet but it doesnt have the randomly gen. msg.

    <script language="JavaScript" type="text/javascript">
    <!-- Copyright 2003, Sandeep Gangadharan -->
    <!-- For more free scripts go to http://sivamdesign.com/scripts/ -->
    <!--
    var y1 = 140; // change the # on the left to adjuct the Y co-ordinate
    (document.getElementById) ? dom = true : dom = false;

    function hideIt() {
    if (dom) {document.getElementById("layer1").style.visibilit y='hidden';}
    }

    function showIt() {
    if (dom) {document.getElementById("layer1").style.visibilit y='visible';}
    }

    function placeIt() {
    if (dom && !document.all) {document.getElementById("layer1").style.top = window.pageYOffset + (window.innerHeight - (window.innerHeight-y1)) + "px";}
    if (document.all) {document.all["layer1"].style.top = document.documentElement.scrollTop + (document.documentElement.clientHeight - (document.documentElement.clientHeight-y1)) + "px";}
    window.setTimeout("placeIt()", 10); }
    // -->
    </script>


    ...then in the body part:

    <div id="layer1" style="position:absolute; left:20; width:410px; height:10; visibility:hidden">
    <font face="verdana, arial, helvetica, sans-serif" size="2">
    <div style="float:left; background-color:yellow; padding:3px; border:1px solid black">
    <span style="float:right; background-color:gray; color:white; font-weight:bold; width='20px'; text-align:center; cursor pointer" onclick="javascript:hideIt()">&nbsp;X&nbsp;</span>
    Don't forget to sign the guestbook.</div>
    </font>
    </font>
    </div>

  2.  


Remove Ads

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
All times are GMT -6. The time now is 05:08 AM.
Powered by vBulletin® Version 4.2.3
Copyright © 2019 vBulletin Solutions, Inc. All rights reserved.
vBulletin Skin By: PurevB.com