View RSS Feed

Post a JavaScript

Custom, non DD related JavaScripts from other members.

  1. YouTube Chromeless Player

    It's not directly obvious from this how we can:
    - start a movie on page load (question asked by some people on different forums);
    - specify the dimensions and position of the movies in percentages;
    - make good use of the ytplayer functions.

    Autoplay: something like
    Code:
    function so_start()
    {
    loadNewVideo('lKq9_kk3Zbc', 20);
    }
    //IE needs some time
    window.onload=setTimeout('so_start()',2000)
    Size of movie in percentages ...

    Updated 08-29-2009 at 01:59 PM by molendijk

    Categories
    Post a JavaScript , Flash related
  2. Using the Select Box as a Navigation Tool

    If we want the select box to function as a genuine menu, then a click on a given option (of the select box) must give us the same range of possibilities as does a click on the items of a normal menu. So a click should allow us to go to a new page, to open a popup window, to produce an alert etc.

    We can achieve this with the help of a function that has the following general form:
    Code:
    var which="";
    function DoSomethingWithOptionvalue(which) {
    var optionValue = document.getElementById(which).options[document.getElementById(which).selectedIndex].value;
    ...

    Updated 08-12-2009 at 12:20 AM by molendijk

    Categories
    Post a JavaScript
  3. Compact Cookie Unit

    Cookies are often confusing. Much of the confusion can be eliminated if you know that all cookies are strings. If you want to store an array, function, number, or an object in a cookie, you must convert it to a string before storage and upon retrieval change it back into the object/array/function/number that it was. Cookies are therefore best used for string storage and retrieval. This unit doesn't pretend to eliminate all of the possible confusions that can arise from "when and where in ...

    Updated 07-10-2010 at 03:59 PM by jscheuer1

    Categories
    Post a JavaScript
  4. Extract external HTML via a hidden text/html-object

    In the head:
    Code:
    <!--[if IE]>
    <script type="text/javascript">
    document.write('<object type="text/html" id="object_id" width="0" height="0" data="menu.html"><\/object>');
    onload=function(){
    document.getElementById('main_page_id').innerHTML = document.getElementById('object_id').object.documentElement.innerHTML;
    }
    </script>
    <![endif]-->
    <!--[if
    ...

    Updated 05-05-2009 at 10:49 PM by molendijk (Correction)

    Categories
    Post a JavaScript
  5. Passing data (whole pages) to a file ('index.html') containing a HTML-menu

    When we use the technique given below, the following happens when we click on a link (in our HTML-menu) in order to go to a new page (which may belong to a foreign domain):
    • bla.html (our own domain) or h ttp://www.blabla.bla (a foreign domain) is included in a dynamically created text/html-object (non-IE) or iframe (IE) (IE doesn't correctly handle the object yet);

    • the object/iframe containing the new page (bla.html or h ttp://www.blabla.bla) is automatically added to a file
    ...

    Updated 03-24-2009 at 11:25 PM by molendijk

    Categories
    Post a JavaScript
Page 3 of 4 FirstFirst 1234 LastLast