Passing an object to a function
<p>I want to pass an object to the function <code>flipIt(obj)</code>. I have the image id stored in a variable called <code>globe</code>.</p>

<p>When I pass <code>globe</code> to <code>flipIt()</code>, it isn't working because <code>globe</code> is a variable containing the image id and <code>flipIt()</code> needs an object.</p>

<p>I have tried <code>('#'+globe)</code> to make it <code>obj</code> but its is also not working:</p>

<pre><code>flipIt('#'+globe);
</code></pre>

<p><strong>Function Definition is:</strong></p>

<pre><code>function flipIt(obj) {
    console.log("value before Function status   " + status);
    alert('FlipIT Called' + obj);

    $(obj).css("-webkit-transform-style","preserve-3d");
    $(obj).css("-webkit-transition","all 1.0s linear");
    $(obj).css("transform-style","preserve-3d");
    $(obj).css("transition","all 1.0s linear");
}    
</code></pre>

<p>I tried by printing obj value... for variable it is printing id value instead it should print HTMLimage element.</p>

<p><strong>Javascript</strong></p>

<pre><code>$(document).ready(function () {
    var globe;

    /*   Reading the data from XML file*/
    $.ajax({
        type: "GET",
        url: "photos.xml",
        dataType: "xml",
        success: function(xml) {
            $(xml).find('item').each(function() {
                var path = $(this).attr('path');
                var width = $(this).attr('width');
                var height = $(this).attr('height');
                var id = $(this).attr('id');
                var alt = $(this).attr('alt');
                var longdesc = $(this).find('longdesc').text();
                var description = $(this).find('desc').text();
                $('#myImageFlow').prepend('&lt;img src="'+path+'" id='+id+'  height="'+height+'"  width="'+ width+'" longdesc="'+longdesc+'" alt="'+alt+'"/&gt;');
                imgArr[i] = description;
                i = i+1;
            });
        });
    });
});
</code></pre>

<p><strong>XML File:</strong></p>

<pre><code>&lt;items id = "items"&gt;
   &lt;item path="img/1_bankofamerica.jpg" width="300" height="360" id="id1" alt="img1" type="bitmapfile"&gt;
      &lt;back&gt;swf/backcard_0.swf &lt;/back&gt;
      &lt;longdesc&gt;img/img1.png&lt;/longdesc&gt;
      &lt;desc&gt;Decription about Image # 1 &lt;/desc&gt;
   &lt;/item&gt;
   &lt;item path="img/2_harbourfront.jpg" width="300" height="360" id="id2" alt="img2" type="bitmapfile"&gt;
      &lt;back&gt;swf/backcard_1.swf &lt;/back&gt;
      &lt;longdesc&gt;img/img2.png&lt;/longdesc&gt;
      &lt;desc&gt;Decription about Image # 2 &lt;/desc&gt;
   &lt;/item&gt;
   &lt;item path="img/2_harbourfront3.jpg" width="300" height="360" id="id3" alt="img3" type="bitmapfile"&gt;
      &lt;back&gt;swf/backcard_2.swf &lt;/back&gt;
      &lt;longdesc&gt;img/img3.png&lt;/longdesc&gt;
      &lt;desc&gt;Decription about Image # 3 &lt;/desc&gt;
   &lt;/item&gt;
   &lt;item path="img/3_harbourfront.jpg" width="300" height="360" id="id4" alt="img4" type="bitmapfile"&gt;
      &lt;back&gt;swf/backcard_3.swf &lt;/back&gt;
      &lt;longdesc&gt;img/img4.png&lt;/longdesc&gt;
      &lt;desc&gt;Decription about Image # 4 &lt;/desc&gt;
   &lt;/item&gt;
   &lt;item path="img/5_lighthouse.jpg" width="300" height="360" id="id5" alt="img5" type="bitmapfile"&gt;
      &lt;back&gt;swf/backcard_4.swf &lt;/back&gt;
      &lt;longdesc&gt;img/img5.png&lt;/longdesc&gt;
      &lt;desc&gt;Decription about Image # 5 &lt;/desc&gt;
   &lt;/item&gt;
&lt;/items&gt;
</code></pre>
