Advanced Search

View RSS Feed

JavaScript & Ajax

  1. Putting text on top of a video

    In July 2010 an enhancement to the YouTube video embed capability became available through a new embed code style. This style uses <iframe> and looks like this:
    <iframe src="http://www.youtube.com/embed/VIDEO_ID?" frameborder="0"></iframe>


    After VIDEO_ID? we can add the normal parameters, like this:
    <iframe src="http://www.youtube.com/embed/VIDEO_ID?start=0&amp;autoplay=1&amp;rel=0&amp;showinfo=0&amp;autohide=0&amp;modestbranding=1&amp;vq=large"
    ...

    Updated 10-14-2012 at 06:10 PM by molendijk

    Categories
    JavaScript & Ajax , CSS related
  2. Select boxes having javascript in the options

    In non-IE except Google Chrome, we can call functions from inside a select box by putting things like the following in the options:
    <option value="bla" onclick="some_function()"></option>
    <option value="bla" onclick="window.open('http://www.google.com')"></option>
    etc.

    This is not possible in IE and Google Chrome. In an earlier attempt to solve the problem, I created a script based on the idea that ...

    Updated 12-01-2011 at 08:46 AM by molendijk (Corrections in text)

    Categories
    JavaScript & Ajax
  3. Deferred document.write

    While surfing on the Internet I found this page on how to pass data from one page to another. After a while, I realized that the script used on the page actually contains a technique (implicitly) for deferring document.write. Just for the fun of it, I modified the script so as to have some easy ways of dynamically inserting internal and external content into a given div via document.write. Here it is:
    Code:
    <script type="text/javascript">
    function HttpRequest(url){
    var pageRequest
    ...

    Updated 10-31-2011 at 06:05 PM by molendijk (Correction)

    Categories
    JavaScript & Ajax
  4. A better Iframe Shim

    The 'iframe shim technique' lets us overlay a div over windowed elements such as flash objects, select boxes and applets. The trick is to have the div accompanied by an iframe that must have exactly the same size and position as the div, whose z-index must be higher than the iframe's z-index. The windowed element itself must have a lower z-index and the iframe should have a background-color. Here's an example of how to have a div overlay a flash object:

    <iframe style="position: ...

    Updated 10-03-2011 at 09:57 AM by molendijk (Correction in text)

    Categories
    JavaScript & Ajax
  5. A Strange Menu-Include

    I was playing around with some code recently and discovered - more or less by accident - that we can include any fully functioning standalone menu by doing the following. The scripts and styles belonging to the external file will be preserved after inclusion:
    1. We put this script just before the closing body-tag of the external file:
    Code:
    <script type="text/javascript">
    try{top.document.getElementById('container_div').innerHTML=document.documentElement.innerHTML}
    ...
    Categories
    JavaScript & Ajax
Page 1 of 2 12 LastLast