Pagina de start a forumului Forum PHP Romania - Discutii despre PHP, MySQL, Javascript, AJAX, etc Forum PHP Romania - Discutii despre PHP, MySQL, Javascript, AJAX, etc
Comunitatea PHP Romania
 

Activate this control
Vezi mesajul original

 
       Pagina de start a forumului Forum PHP Romania - Discutii despre PHP, MySQL, Javascript, AJAX, etc -> PHP & Flash
Subiectul anterior :: Subiectul următor  
Autor Mesaj
diablo



Data înscrierii: 20/Mai/2005
Mesaje: 335
Locație: Bucuresti

Trimis: Lun Sep 24, 2007 7:12 pm    Titlul subiectului: Activate this control  

Cum scap de "Click to activate this control" de pe un banner ?
Sus  
rpsetzer



Data înscrierii: 06/Mai/2007
Mesaje: 36

Trimis: Lun Sep 24, 2007 11:47 pm    Titlul subiectului:  

Faci un js cu urmatorul cod:

var bo_ns_id = 0;

function startIeFix(){
if(isIE()){
document.write('<div id="bo_ns_id_' + bo_ns_id + '"><!-- ');
}
}

function endIeFix(){
if(isIE()){
document.write('</div>');
var theObject = document.getElementById("bo_ns_id_" + bo_ns_id++);
var theCode = theObject.innerHTML;
theCode = theCode.substring(4 ,9+theCode.indexOf("</object>"))
document.write(theCode);
}
}

function isIE(){
// only for Win IE 6+
// But not in Windows 98, Me, NT 4.0, 2000
var strBrwsr= navigator.userAgent.toLowerCase();
if(strBrwsr.indexOf("msie") > -1 && strBrwsr.indexOf("mac") < 0){
if(parseInt(strBrwsr.charAt(strBrwsr.indexOf("msie")+5)) < 6){
return false;
}
if(strBrwsr.indexOf("win98") > -1 ||
strBrwsr.indexOf("win 9x 4.90") > -1 ||
strBrwsr.indexOf("winnt4.0") > -1 ||
strBrwsr.indexOf("windows nt 5.0") > -1)
{
return false;
}
return true;
}else{
return false;
}
}

Apoi incluzi acest js DUPA codul bannerului.
Sus  
diablo



Data înscrierii: 20/Mai/2005
Mesaje: 335
Locație: Bucuresti

Trimis: Mar Sep 25, 2007 5:20 pm    Titlul subiectului:  

am psu intr-un js codul si am inclus js-ul dupa banner dar nu mere.....am IE 7
Sus  
yokozona



Data înscrierii: 12/Mai/2005
Mesaje: 293
Locație: Turnul Chindiei

Trimis: Sâm Sep 29, 2007 10:33 pm    Titlul subiectului:  

uite aici un script care merge bine

asa arata fisierul javascript

Cod:
var jActivating =
{

   /**
    * Declare constants
    * IS_MSIE   checks for Internet Explorer 6 and later versions
    * TAGS      array with affected HTML tags
    */
   IS_MSIE : (document.removeNode && document.createAttribute) ? true : false,
   TAGS : ['object', 'embed', 'applet'],
   
   
   /**
    * Activates embedded content reinserting it.
    * @return void
    */
   activateContent : function()
   {
      var i = 0;
      for(var _tagName; _tagName = jActivating.TAGS[i]; i++)
      {
         var j = 0;
         for(var _node; _node = document.getElementsByTagName(_tagName)[j]; j++)
         {
            if(jActivating.IS_MSIE)
            {
               jActivating.reinsertHtml(_node);
            }
            else
            {
               jActivating.reinsertNode(_node);
            }
         }
         
      }
      jActivating = null;
   },
   
   
   /**
    * Sets outerHTML property.
    * @param object   - The node
    * @return void
    */
   reinsertHtml : function(_node)
   {
      var _htmlCode = jActivating.getHtmlCode(_node);
      if(_htmlCode)
      {
         _node.outerHTML = _htmlCode;
      }
   },
   
   
   /**
    * Replaces the node for a clone.
    * @param object - The original node
    * @return void
    */
   reinsertNode : function(_node)
   {
      var _clone = _node.cloneNode(true);
      var _parent = _node.parentNode;
      if(_clone && _parent)
      {
         _parent.replaceChild(_clone, _node);
      }
   },
   
   
   /**
    * Retrieves the object and its content in HTML.
    * @param object - The analyzed node
    * @return string - The HTML received, NULL for malformed syntax (end tag)
    */
   getHtmlCode : function(_node)
   {
      var _htmlCode = _node.outerHTML;
      var _name = _node.nodeName.toLowerCase();
      if(_name == 'embed')
      {
         return _htmlCode;
      }
      if(_name == 'object' || _name == 'applet')
      {
         var _startTag = _htmlCode.substr(0, _htmlCode.indexOf('>') + 1);
         var _endTag = _htmlCode.substr(_htmlCode.length - 9).toLowerCase();
         // Filters malformed syntax for avoid unexpected results
         if(_endTag != '</object>' && _endTag != '</applet>')
         {
            return null;
         }
         var _innerHtml = jActivating.getInnerHtml(_node);
         _htmlCode = _startTag + _innerHtml + _endTag;
         return _htmlCode;
      }
   },
   
   
   /**
    * Retrieves the HTML between start and end tags of the object.
    * @param object - The analyzed node
    * @return string - The HTML received
    *
    * NOTE: the innerHTML property isn't used because Internet Explorer
    * sometimes returns a empty result.
    */
   getInnerHtml : function(_node)
   {
      var _innerHtml = '';
      var i = 0;
      for(var _childNode; _childNode = _node.childNodes[i]; i++)
      {
         _innerHtml += _childNode.outerHTML;
      }
      return _innerHtml;
   }
}

// Execute script only for Internet Explorer (6+) and Opera (9+)
if(jActivating.IS_MSIE)
{
   jActivating.activateContent();
}
else if(window.opera)
{
   document.addEventListener('DOMContentLoaded', jActivating.activateContent, false);
}

e foarte important sa specifici in felul urmator atunci cand incarci js'ul

<script type="text/javascript" src="embeddedcontent.js" defer="defer"></script>
Sus  
PHPRomania Bot
Bot Member


Data înscrierii: 27/Dec/2007
Mesaje: 1
Locaţie: Server Google
Trimis: Mie Dec 26, 2007 7:01 pm   Titlul subiectului: Ad  

Sus  
 
       Pagina de start a forumului Forum PHP Romania - Discutii despre PHP, MySQL, Javascript, AJAX, etc -> PHP & Flash
Pagina 1 din 1


Powered by phpBB 2.0.22 © 2001, 2002 phpBB Group
Varianta în limba română: Romanian phpBB online community