Web Analytics Made Easy -
StatCounter Kinda like combining or duplicating a script - CodingForum

Announcement

Collapse
No announcement yet.

Kinda like combining or duplicating a script

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • Kinda like combining or duplicating a script

    Hi

    I found this script and would like to use it twice on the same page. meaning two instances of it.
    one on the left where it is now, and the other on the right...
    ie two FLOATING MENUS

    Can anyone please help. The site is


    <span id="staticcombo" style="position:absolute;left:0;top:0;visibility:hidden">
    <form name="jumpy">
    <p><select name="example" size="1" onChange="gone()">
    <option value="http://www.codearena.com">CodeArena.com</option>
    <option value="http://www.dynamicdrive.com">Dynamic Drive</option>
    <option value="http://www.geocities.com">Geocities</option>
    <option value="http://www.cnn.com">CNN</option>
    </select>

    <script language="javascript">
    <!--

    /*Always-visible combo box credit:
    JavaScript Kit (www.javascriptkit.com)
    Over 400+ free JavaScripts here!
    */

    function gone()
    {
    location=document.jumpy.example.options[document.jumpy.example.selectedIndex].value
    }
    //-->
    </script>

    <input type="button" name="test" value="Go!"
    onClick="gone()">
    </p>
    </form>
    </span>


    <script language="JavaScript1.2">
    var combowidth=''
    var comboheight=''

    function initialize(){
    if (document.all){
    combowidth=staticcombo.offsetWidth
    comboheight=staticcombo.offsetHeight
    setInterval("staticit_ie()",50)
    staticcombo.style.visibility="visible"
    }
    else if (document.layers){
    combowidth=document.staticcombo.document.width
    comboheight=document.staticcombo.document.height
    setInterval("staticit_ns()",50)
    document.staticcombo.visibility="show"
    }
    }

    function staticit_ie(){
    staticcombo.style.pixelLeft=document.body.scrollLeft+document.body.clientWidth-combowidth-30
    staticcombo.style.pixelTop=document.body.scrollTop+document.body.clientHeight-comboheight
    }

    function staticit_ns(){
    document.staticcombo.left=pageXOffset+window.innerWidth-combowidth-30
    document.staticcombo.top=pageYOffset+window.innerHeight-comboheight
    }

    window.onload=initialize
    </script>

    thanks
    peter
    Hi

  • #2
    Here ya go this should work

    -----------

    <html>
    <head>
    <title>Double Combo</title>
    <script language="javascript">
    <!--

    /*Always-visible combo box credit:
    JavaScript Kit (www.javascriptkit.com)
    Over 400+ free JavaScripts here!
    */

    function gone()
    {
    location=document.jumpy.example.options[document.jumpy.example.selectedIndex].value
    }
    //-->
    </script>


    <script language="JavaScript1.2">
    var combowidth=''
    var comboheight=''

    function initialize(){
    if (document.all){
    combowidth=staticcombo.offsetWidth
    comboheight=staticcombo.offsetHeight
    setInterval("staticit_ie()",50)
    staticcombo.style.visibility="visible"
    }
    else if (document.layers){
    combowidth=document.staticcombo.document.width
    comboheight=document.staticcombo.document.height
    setInterval("staticit_ns()",50)
    document.staticcombo.visibility="show"
    }
    }

    function staticit_ie(){
    staticcombo.style.pixelLeft=document.body.scrollLeft+document.body.clientWidth-combowidth-30
    staticcombo.style.pixelTop=document.body.scrollTop+document.body.clientHeight-comboheight
    }

    function staticit_ns(){
    document.staticcombo.left=pageXOffset+window.innerWidth-combowidth-30
    document.staticcombo.top=pageYOffset+window.innerHeight-comboheight
    }

    </script>


    <script language="javascript">
    <!--

    /*Always-visible combo box credit:
    JavaScript Kit (www.javascriptkit.com)
    Over 400+ free JavaScripts here!
    */

    function gone()
    {
    location=document.jumpy2.example2.options[document.jumpy2.example2.selectedIndex].value
    }
    //-->
    </script>


    <script language="JavaScript1.2">
    var combowidth=''
    var comboheight=''

    function initialize2(){
    if (document.all){
    combowidth=staticcombo2.offsetWidth
    comboheight=staticcombo2.offsetHeight
    setInterval("staticit_ie2()",50)
    staticcombo2.style.visibility="visible"
    }
    else if (document.layers){
    combowidth=document.staticcombo2.document.width
    comboheight=document.staticcombo2.document.height
    setInterval("staticit_ns2()",50)
    document.staticcombo2.visibility="show"
    }
    }

    function staticit_ie2(){
    staticcombo2.style.pixelLeft=document.body.scrollLeft+document.body.clientWidth-combowidth-610
    staticcombo2.style.pixelTop=document.body.scrollTop+document.body.clientHeight-comboheight
    }

    function staticit_ns2(){
    document.staticcombo2.left=pageXOffset+window.innerWidth-combowidth-610
    document.staticcombo2.top=pageYOffset+window.innerHeight-comboheight
    }
    </script>

    </head>
    <body onload="initialize() + initialize2()">

    <span id="staticcombo" style="position:absolute;left:0;top:0;visibility:hidden">
    <form name="jumpy">
    <p><select name="example" size="1" onChange="gone()">
    <option value="http://www.codearena.com">CodeArena.com</option>
    <option value="http://www.dynamicdrive.com">Dynamic Drive</option>
    <option value="http://www.geocities.com">Geocities</option>
    <option value="http://www.cnn.com">CNN</option>
    </select>

    <input type="button" name="test" value="Go!"
    onClick="gone()">
    </p>
    </form>
    </span>

    <span id="staticcombo2" style="position:absolute;left:0;top:0;visibility:hidden">
    <form name="jumpy2">
    <p><select name="example2" size="1" onChange="gone()">
    <option value="http://www.codearena.com">CodeArena.com</option>
    <option value="http://www.dynamicdrive.com">Dynamic Drive</option>
    <option value="http://www.geocities.com">Geocities</option>
    <option value="http://www.cnn.com">CNN</option>
    </select>

    <input type="button" name="test2" value="Go!"
    onClick="gone()">
    </p>
    </form>
    </span>

    </body>
    </html>

    ------------


    Hope it works for ya
    CYWebmaster.com - See why we dot com!!
    ACJavascripts.com - Cut & Paste Javascripts!
    SimplyProgram.com - Personal Blog

    Comment


    • #3
      Much thanks ACjavascript

      Great, Very Great works like a peach...perfectamundo...

      Very much appreciated
      Hi

      Comment


      • #4
        Hi again
        AC are you still around...can you fix this, or shed some light on it?

        Both scripts have different links....
        However both scripts go to the same URLS/links even though the URLs descriptions differ..... I double checked to see if I screwed up somewhere...but I cannot find any ...

        Does anyone have any idea what I could have done to cause this.

        Thanks
        Hi

        Comment


        • #5
          Yea i'm here. hehe

          The Problem is that both selects were calling the same function ( gone() )

          So what i did is i created a second gone2() function for the second select.

          Its here in the code boldfaced

          -------------------

          <html>
          <head>
          <title>Double Combo</title>
          <script language="javascript">
          <!--

          /*Always-visible combo box credit:
          JavaScript Kit (www.javascriptkit.com)
          Over 400+ free JavaScripts here!
          */

          function gone()
          {
          location=document.jumpy.example.options[document.jumpy.example.selectedIndex].value
          }

          //-->
          </script>


          <script language="JavaScript1.2">
          var combowidth=''
          var comboheight=''

          function initialize(){
          if (document.all){
          combowidth=staticcombo.offsetWidth
          comboheight=staticcombo.offsetHeight
          setInterval("staticit_ie()",50)
          staticcombo.style.visibility="visible"
          }
          else if (document.layers){
          combowidth=document.staticcombo.document.width
          comboheight=document.staticcombo.document.height
          setInterval("staticit_ns()",50)
          document.staticcombo.visibility="show"
          }
          }

          function staticit_ie(){
          staticcombo.style.pixelLeft=document.body.scrollLeft+document.body.clientWidth-combowidth-30
          staticcombo.style.pixelTop=document.body.scrollTop+document.body.clientHeight-comboheight
          }

          function staticit_ns(){
          document.staticcombo.left=pageXOffset+window.innerWidth-combowidth-30
          document.staticcombo.top=pageYOffset+window.innerHeight-comboheight
          }

          </script>


          <script language="javascript">
          <!--

          /*Always-visible combo box credit:
          JavaScript Kit (www.javascriptkit.com)
          Over 400+ free JavaScripts here!
          */

          function gone2()
          {
          location=document.jumpy2.example2.options[document.jumpy2.example2.selectedIndex].value
          }

          //-->
          </script>


          <script language="JavaScript1.2">
          var combowidth=''
          var comboheight=''

          function initialize2(){
          if (document.all){
          combowidth=staticcombo2.offsetWidth
          comboheight=staticcombo2.offsetHeight
          setInterval("staticit_ie2()",50)
          staticcombo2.style.visibility="visible"
          }
          else if (document.layers){
          combowidth=document.staticcombo2.document.width
          comboheight=document.staticcombo2.document.height
          setInterval("staticit_ns2()",50)
          document.staticcombo2.visibility="show"
          }
          }

          function staticit_ie2(){
          staticcombo2.style.pixelLeft=document.body.scrollLeft+document.body.clientWidth-combowidth-610
          staticcombo2.style.pixelTop=document.body.scrollTop+document.body.clientHeight-comboheight
          }

          function staticit_ns2(){
          document.staticcombo2.left=pageXOffset+window.innerWidth-combowidth-610
          document.staticcombo2.top=pageYOffset+window.innerHeight-comboheight
          }
          </script>

          </head>
          <body onload="initialize() + initialize2()">

          <span id="staticcombo" style="position:absolute;left:0;top:0;visibility:hidden">
          <form name="jumpy">
          <p><select name="example" size="1" onChange="gone()">
          <option value="http://www.codearena.com">CodeArena.com</option>
          <option value="http://www.dynamicdrive.com">Dynamic Drive</option>
          <option value="http://www.geocities.com">Geocities</option>
          <option value="http://www.cnn.com">CNN</option>
          </select>

          <input type="button" name="test" value="Go!"
          onClick="gone()">
          </p>
          </form>
          </span>

          <span id="staticcombo2" style="position:absolute;left:0;top:0;visibility:hidden">
          <form name="jumpy2">
          <p><select name="example2" size="1" onChange="gone2()">
          <option value="http://www.codearena.com">CodeArena.com</option>
          <option value="http://www.dynamicdrive.com">Dynamic Drive</option>
          <option value="http://www.geocities.com">Geocities</option>
          <option value="http://www.cnn.com">CNN</option>
          </select>

          <input type="button" name="test2" value="Go!"
          onClick="gone2()">
          </p>
          </form>
          </span>

          </body>
          </html>


          -------------

          HappyScripting
          CYWebmaster.com - See why we dot com!!
          ACJavascripts.com - Cut & Paste Javascripts!
          SimplyProgram.com - Personal Blog

          Comment


          • #6
            thanks again

            Very logical and simple when you think about it ain't it....?
            I can kick myself for not at least trying to figure that out...
            After the effort you put in, in changing the duplications to make them unique...
            Oh well I am new, I hope to catch on

            Thanks, very much...
            Hi

            Comment


            • #7
              Dont kick yourself. Everyone learns something new everyday. Whether it be javascript or a good ol lesson about life. If you look at this forum you can see my name popup like 10 times asking for some help. Good Luck
              CYWebmaster.com - See why we dot com!!
              ACJavascripts.com - Cut & Paste Javascripts!
              SimplyProgram.com - Personal Blog

              Comment


              • #8
                new enhanced uasge a TRIPLE combo floating script.

                Hi A*C

                On your recommendation, I have not kicked myself.... Thanks for the support...

                With your permission I am going to "lean" on your skills just a little more...

                I figured the site would be complete if I had a third floating menu in it...

                I now understand the script logic...

                How would I place third floating menu in the script....?

                Thanks
                Hi

                Comment


                • #9
                  Sure no problem

                  -----------

                  <html>
                  <head>
                  <title>Double Combo</title>
                  <script language="javascript">
                  <!--

                  /*Always-visible combo box credit:
                  JavaScript Kit (www.javascriptkit.com)
                  Over 400+ free JavaScripts here!
                  */

                  function gone()
                  {
                  location=document.jumpy.example.options[document.jumpy.example.selectedIndex].value
                  }

                  //-->
                  </script>


                  <script language="JavaScript1.2">
                  var combowidth=''
                  var comboheight=''

                  function initialize(){
                  if (document.all){
                  combowidth=staticcombo.offsetWidth
                  comboheight=staticcombo.offsetHeight
                  setInterval("staticit_ie()",50)
                  staticcombo.style.visibility="visible"
                  }
                  else if (document.layers){
                  combowidth=document.staticcombo.document.width
                  comboheight=document.staticcombo.document.height
                  setInterval("staticit_ns()",50)
                  document.staticcombo.visibility="show"
                  }
                  }

                  function staticit_ie(){
                  staticcombo.style.pixelLeft=document.body.scrollLeft+document.body.clientWidth-combowidth-30
                  staticcombo.style.pixelTop=document.body.scrollTop+document.body.clientHeight-comboheight
                  }

                  function staticit_ns(){
                  document.staticcombo.left=pageXOffset+window.innerWidth-combowidth-30
                  document.staticcombo.top=pageYOffset+window.innerHeight-comboheight
                  }

                  </script>
                  <script language="javascript">
                  <!--

                  /*Always-visible combo box credit:
                  JavaScript Kit (www.javascriptkit.com)
                  Over 400+ free JavaScripts here!
                  */

                  function gone3()
                  {
                  location=document.jumpy3.example3.options[document.jumpy3.example3.selectedIndex].value
                  }

                  //-->
                  </script>


                  <script language="JavaScript1.2">
                  var combowidth=''
                  var comboheight=''

                  function initialize3(){
                  if (document.all){
                  combowidth=staticcombo3.offsetWidth
                  comboheight=staticcombo3.offsetHeight
                  setInterval("staticit_ie3()",50)
                  staticcombo3.style.visibility="visible"
                  }
                  else if (document.layers){
                  combowidth=document.staticcombo3.document.width
                  comboheight=document.staticcombo3.document.height
                  setInterval("staticit_ns3()",50)
                  document.staticcombo3.visibility="show"
                  }
                  }

                  function staticit_ie3(){
                  staticcombo3.style.pixelLeft=document.body.scrollLeft+document.body.clientWidth-combowidth-320
                  staticcombo3.style.pixelTop=document.body.scrollTop+document.body.clientHeight-comboheight
                  }

                  function staticit_ns3(){
                  document.staticcombo3.left=pageXOffset+window.innerWidth-combowidth-320
                  document.staticcombo3.top=pageYOffset+window.innerHeight-comboheight
                  }

                  </script>

                  <script language="javascript">
                  <!--

                  /*Always-visible combo box credit:
                  JavaScript Kit (www.javascriptkit.com)
                  Over 400+ free JavaScripts here!
                  */

                  function gone2()
                  {
                  location=document.jumpy2.example2.options[document.jumpy2.example2.selectedIndex].value
                  }
                  //-->
                  </script>


                  <script language="JavaScript1.2">
                  var combowidth=''
                  var comboheight=''

                  function initialize2(){
                  if (document.all){
                  combowidth=staticcombo2.offsetWidth
                  comboheight=staticcombo2.offsetHeight
                  setInterval("staticit_ie2()",50)
                  staticcombo2.style.visibility="visible"
                  }
                  else if (document.layers){
                  combowidth=document.staticcombo2.document.width
                  comboheight=document.staticcombo2.document.height
                  setInterval("staticit_ns2()",50)
                  document.staticcombo2.visibility="show"
                  }
                  }

                  function staticit_ie2(){
                  staticcombo2.style.pixelLeft=document.body.scrollLeft+document.body.clientWidth-combowidth-610
                  staticcombo2.style.pixelTop=document.body.scrollTop+document.body.clientHeight-comboheight
                  }

                  function staticit_ns2(){
                  document.staticcombo2.left=pageXOffset+window.innerWidth-combowidth-610
                  document.staticcombo2.top=pageYOffset+window.innerHeight-comboheight
                  }
                  </script>

                  </head>
                  <body onload="initialize() + initialize2() + initialize3()">

                  <span id="staticcombo" style="position:absolute;left:0;top:0;visibility:hidden">
                  <form name="jumpy">
                  <p><select name="example" size="1" onChange="gone()">
                  <option value="http://www.codearena.com">CodeArena.com</option>
                  <option value="http://www.dynamicdrive.com">Dynamic Drive</option>
                  <option value="http://www.geocities.com">Geocities</option>
                  <option value="http://www.cnn.com">CNN</option>
                  </select>

                  <input type="button" name="test" value="Go!"
                  onClick="gone()">
                  </p>
                  </form>
                  </span>

                  <span id="staticcombo2" style="position:absolute;left:0;top:0;visibility:hidden">
                  <form name="jumpy2">
                  <p><select name="example2" size="1" onChange="gone2()">
                  <option value="http://www.codearena.com">CodeArena.com</option>
                  <option value="http://www.dynamicdrive.com">Dynamic Drive</option>
                  <option value="http://www.geocities.com">Geocities</option>
                  <option value="http://www.cnn.com">CNN</option>
                  </select>

                  <input type="button" name="test2" value="Go!"
                  onClick="gone2()">
                  </p>
                  </form>
                  </span>

                  <span id="staticcombo3" style="position:absolute;left:0;top:0;visibility:hidden">
                  <form name="jumpy3">
                  <p><select name="example3" size="1" onChange="gone3()">
                  <option value="http://www.codearena.com">CodeArena.com</option>
                  <option value="http://www.dynamicdrive.com">Dynamic Drive</option>
                  <option value="http://www.geocities.com">Geocities</option>
                  <option value="http://www.cnn.com">CNN</option>
                  </select>

                  <input type="button" name="test3" value="Go!"
                  onClick="gone2()">
                  </p>
                  </form>
                  </span>
                  </body>
                  </html>

                  ------------


                  HappyScripting
                  CYWebmaster.com - See why we dot com!!
                  ACJavascripts.com - Cut & Paste Javascripts!
                  SimplyProgram.com - Personal Blog

                  Comment


                  • #10
                    Thankyou A*C

                    Resolved

                    I have followed your logic and have adapted my first script as a newbie...I feel great...not a major thing in the life of you great scripters, but a major, major, major, hurdle for me...it means I kinda know what is happening and where it is happening in the script...

                    I notice you have provided the solution in your usual helpful way...
                    Thanks...
                    Can I add colour to the background...I want colour code the menus, right now they blend in on the page(not such a bad idea) but I may use the option for colour...

                    1. I have permission to link to information on another site.
                    2. I would like to show the information/content as it is.
                    3. When the link is clicked (in a floating menu)
                    ///4. I wish for the pages to be shown BUT WITHIN my pages with the information that I want to show...///

                    How is that possible...
                    This is the site...that I wish to link to:
                    http://www.albaraka.com/english/reso...twa/index.html />
                    as well as this one:
                    http://www.itpapers.com/ />
                    Can you help in this....
                    Last edited by peter; Jul 2, 2002, 10:35 PM.
                    Hi

                    Comment


                    • #11
                      Sure no problem.

                      1) Color the menus



                      Go there and look at the Select BgChanger & Select BgFader.
                      There both mine so your free to use them

                      If you don't want that then just put this right before the ending of the select tag

                      style="background-color:black;color:lime;">

                      the full code

                      <select name="whatever" onchange="whatever" style="background-color:black;color:lime;">

                      2)Linking

                      Well you could acomplish what you want by useing frames. The bottom frame has your selects, and the main frame(the rest of the window) can show the links. Something like that, what do you think?



                      CYWebmaster.com - See why we dot com!!
                      ACJavascripts.com - Cut & Paste Javascripts!
                      SimplyProgram.com - Personal Blog

                      Comment


                      • #12
                        Hmmmm...

                        I guess...though I am kinda running from the technicality of imposing frames on a site that never had them originally....but I guess...you guessed it I am knind a confused....

                        Or perhaps I could just have them come up in a new browser window...that would make my browsers still on site...
                        But somehow I feel better framing, there is that word...'framing' their page in mine, which they do not mind...

                        You advise me...I do not know how technical or simple what I want is...really.


                        Checked the site, thanks for the script and colouring.

                        thanks
                        Hi

                        Comment


                        • #13
                          If you don't want to use frames you could always use and iframe. AN iframe will let you load a site into it without changing the contents around it. Its like a frame but it isn't. I think for what your trying to do it might be better to go with the iframe

                          Thats my opion though, hehe so what your think?
                          I can help you code in the frames and in iframe so whatever you choose

                          Do you use AOL?
                          I ask this b/c we could get an IM going and i could help you all in one shot hehehe
                          CYWebmaster.com - See why we dot com!!
                          ACJavascripts.com - Cut & Paste Javascripts!
                          SimplyProgram.com - Personal Blog

                          Comment


                          • #14
                            Thanks

                            Great, I sent you a mail.
                            Hi

                            Comment

                            Working...
                            X