Visualizzazione dei risultati da 1 a 2 su 2
  1. #1
    Utente di HTML.it
    Registrato dal
    Jan 2012
    Messaggi
    39

    PICCOLO AIUTINO? secondo voi perché nn va?

    Ragazzi chi mi aiuta a capire perché questo script non funziona?

    codice:
    <script language="javascript" type="text/javascript">
    
    /* 
      linkWord(obj)
      written by Christian Heilmann (http://wait-till-i.com)
      automatically turns words defined in the object obj into 
      hyperlink. 
      The object obj sent as a paramater needs to contain all the words
      properties and the associated URLs as values.
      Demo object: 
      {
        'wait-till-i.com':'http://wait-till-i.com',
        'icant.co.uk':'http://icant.co.uk'
      }
    */
     
    function linkWord(obj){
      for(i in obj){
        var x = document.body.innerHTML;
        var linkStart = '<a href="'+obj[i]+'">';     
        var linkEnd = '</a>';     
        var reg = new RegExp ('\\b' + i + '\\b','g');
        x = x.replace(reg, linkStart + i + linkEnd);
        document.body.innerHTML = x;
      }
    }
      
    Settings:
     
    {
      'example':'http://www.example.com',
      'another':'http://icant.co.uk'
    }
    
    </script>
    GRAZIE MILLE A TUTTI!!

  2. #2

Permessi di invio

  • Non puoi inserire discussioni
  • Non puoi inserire repliche
  • Non puoi inserire allegati
  • Non puoi modificare i tuoi messaggi
  •  
Powered by vBulletin® Version 4.2.1
Copyright © 2025 vBulletin Solutions, Inc. All rights reserved.