Results 1 to 3 of 3

Thread: out side of function or inside of function

  1. #1
    Join Date
    Nov 2006
    Posts
    236
    Thanks
    4
    Thanked 1 Time in 1 Post

    Default out side of function or inside of function

    I'm having a detection script problem i need to call it's results from another function and I'm not sure how to fix the problem I know it's not right and i know why somewhat but not enoug to fix it. Ive tried moving around the function and checking everything else.

    see the div is not poping up nore are the Iframes. Which do work as far as I know because I tested the code before. i'm only posting part of the code because this is where Ithink the problem is. there is a div that gets in Iframe depending on which plugin you have.

    Code:
    $plugin_type = {    
    'SVG Viewer': {        
    'ieAndWin': 'Adobe.SVGCtl',        
    'nsOrMac': 'image/svg-xml'    },    
    
    'Shockwave Director': {        
    'ieAndWin': 'SWCtl.SWCtl.1',        
    'nsOrMac': 'application/x-director'    },    
    
    'Flash': {        
    'ieAndWin': 'ShockwaveFlash.ShockwaveFlash.1',        
    'nsOrMac': 'application/x-shockwave-flash'    },    
    
    'RealPlayer': {        
    'ieAndWin': 'rmocx.RealPlayer G2 Control.1',        
    'nsOrMac': 'audio/x-pn-realaudio-plugin'    },    
    
    'QuickTime': {        
    'ieAndWin': 'QuickTimeCheckObject.QuickTimeCheck.1',        
    'nsOrMac': 'video/quicktime'    },    
    
    'Windows Media Player': {        
    'ieAndWin': 'MediaPlayer.MediaPlayer.1',        
    'nsOrMac': 'application/x-mplayer2'    },    
    
    'Acrobat Reader': {        
    'ieAndWin': 'PDF.PdfCtrl.5',        
    'nsOrMac': 'application/pdf'    }}; function detectPlugin( $inPluginName ){    
    var agt = navigator.userAgent.toLowerCase();    
    var ie  = ( agt.indexOf('msie') != -1 );    
    var ns  = ( navigator.appName.indexOf('Netscape') != -1 );    
    var win = ( ( agt.indexOf('win') != -1 ) || ( agt.indexOf('32bit') != -1 ) );    
    var mac = ( agt.indexOf('mac') != -1 );     
    
    $pluginEnabled = false;     
    
    if( $inPluginName != 'Java' )    {       
          
    	  if( ie && win )        
    	  {            
    $pluginEnabled = detectIE( $plugin_type[$inPluginName]['ieAndWin'] );        }         
          
    	  if( ns || !win )        {            nse = '';            
    	         
    			
     for( var i = 0; i < navigator.mimeTypes.length; i++ )            
    			 
    {                nse += navigator.mimeTypes[i].type.toLowerCase();            }             
    $pluginEnabled = detectNS( $plugin_type[$inPluginName]['nsOrMac'] );        }    }    
    	  
    	  else    
    {        $pluginEnabled = navigator.javaEnabled() ? true : false;    }    
    	  
    	   
    	   return $pluginEnabled ;}  
    	   
    	   
    	   function detectNS( ClassID ){    n = '';    
    	   if( nse.indexOf( ClassID ) != -1 )    {        
    	   
    	   if( navigator.mimeTypes[ClassID].enabledPlugin != null )        {   return true;  }        
    	   
    	   else        {     return false;   }    }} 
    	   
    	   
    	   
    	   function detectIE( ClassID ){    result = false;     
    	   // this line needs to be broken to prevent errors in internet explorer, hence the strangeness in the middle of
    </SC' + 'RIPT>    
    document.write( '<SCRIPT LANGUAGE=VBScript>\n on error resume next \n 
    
    result = IsObject( CreateObject("' + ClassID + '") )</SC' + 'RIPT>' );    
     if( result )    {        return true;    }    
     
     else    {        return false;    }} 
     // ============================
    //  this portion determines what to do
    // ===========================
     if( detectPlugin( 'QuickTime' ) == true ){QUIFrame()}
     
     else if( detectPlugin( 'Windows Media Player' ) == true ){WMPFrame()}
     
     else{read()}

    and this the one that is not working right.



    window.onload = function() { var links = document.getElementsByTagName('a'); for (var i = 0; i < links.length; i++) { if (links[i].className == 'movieloader') {

    /*find links with class="movieloader" */
    links[i].onclick = function(e) {

    /* attach function to each */
    if (window.event) window.event.returnValue = false; else e.preventDefault();
    /*stop browser from going to link href */
    var mP = document.getElementById('misterioProgram'); mP.style.display = 'block'; if( detectPlugin( 'QuickTime' ) == true ){frames['timeframe'].document.getElementById('misterioProgram').getElementsByTagName('embed')[0].src = this.href;

    frames['timeframe'].document.getElementById('misterioProgram').getElementsByTagName('param')[0].value = this.href; }

    else if( detectPlugin( 'Windows Media Player' ) == true ){frames['playerframe'].document.getElementById('misterioProgram').getElementsByTagName('embed')[0].src = this.href;

    frames['playerframe'].document.getElementById('misterioProgram').getElementsByTagName('param')[0].value = this.href; } } } }}

    the area in red is what I'm worried about. both functions are in the head section.

  2. #2
    Join Date
    Nov 2006
    Posts
    236
    Thanks
    4
    Thanked 1 Time in 1 Post

    Default

    I am sorry about this last post and will move this issue to PMs but will keep the topic up if anyone want to post here.
    Last edited by riptide; 07-12-2007 at 12:55 AM.

  3. #3
    Join Date
    Nov 2006
    Posts
    236
    Thanks
    4
    Thanked 1 Time in 1 Post

    Default

    ah well I'm posting this here because i can't send file by PM

    I was able to go change it back to the classname object jscheuer1

    I had ended up using a function that did the same thing but had worked when I needed to send the link herf to the object and embed tags. I had only asked him to help me find out why using a varable didn't work. I stil don't know why but the function was fixed by using this herf.

    That is what I would have tried last. but anyway I went to to find out that the way I grabbed the pram and embed tags was right all along. however this code doesn't like to work in IE even thoug it had worked in Fire Fox.

    when got around to connection the detection script tot I ran into more problem but it seems like it's connected right. It does display the right iframe.

    in IE but I think my plug in is broken. it crashes in fire fox.

    just save the files in the same folder.
    Last edited by riptide; 07-12-2007 at 04:17 PM. Reason: computer crashed wile typing

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •