Visualizzazione dei risultati da 1 a 3 su 3

Discussione: Problemi di style

  1. #1

    Problemi di style

    Ciao a tutti,
    ho trovato questo script per un news ticker con file esterno. Funziona tutto ma non riesco a cambiare il colore dei link. Come posso fare?

    Ecco il codice:


    <script language="JavaScript1.2">
    var tickercontainer='<div align="center" id="container" style="background-color:#485cc8;border-width:1;border-style:solid;border- color:#485cc8;width:261;height:35;font:bold 10px Verdana;color:#ffffff;"></div>'

    var xmlsource="messaggi.xml"

    if (window.ActiveXObject)
    var xmlDoc = new ActiveXObject("Microsoft.XMLDOM");
    else if (document.implementation && document.implementation.createDocument)
    var xmlDoc= document.implementation.createDocument("","doc",nu ll);
    if (typeof xmlDoc!="undefined"){
    document.write(tickercontainer)
    xmlDoc.load(xmlsource)
    }

    var notWhitespace = /\S/

    function init_ticker(){

    tickerobj=xmlDoc.getElementsByTagName("xmlticker")


    for (i=0;i<tickerobj.childNodes.length;i++){
    if ((tickerobj.childNodes[i].nodeType == 3)&&(!notWhitespace.test(tickerobj.childNodes[i].nodeValue))) {
    tickerobj.removeChild(tickerobj.childNodes[i])
    i--
    }
    }
    document.getElementById("container").innerHTML=tic kerobj.childNodes[1].firstChild.nodeValue
    msglength=tickerobj.childNodes.length
    currentmsg=2
    themessage=''
    setInterval("rotatemsg()",tickerobj.childNodes
    .firstChild.nodeValue)
    }

    function rotatemsg(){
    var msgsobj=tickerobj.childNodes[currentmsg]
    if (msgsobj.getAttribute("url")!=null){
    themessage='<a href="'+msgsobj.getAttribute("url")+'"'
    if (msgsobj.getAttribute("target")!=null)
    themessage+=' target="'+msgsobj.getAttribute("target")+'"'
    themessage+='>'
    }
    themessage+=msgsobj.firstChild.nodeValue
    if (msgsobj.getAttribute("url")!=null)
    themessage+='</a>'

    document.getElementById("container").innerHTML=the message
    currentmsg=(currentmsg<msglength-1)? currentmsg+1 : 1
    themessage=''
    }

    function fetchxml(){
    if (xmlDoc.readyState==4)
    init_ticker()
    else
    setTimeout("fetchxml()",10)
    }

    if (window.ActiveXObject)
    fetchxml()
    else if (typeof xmlDoc!="undefined")
    xmlDoc.onload=init_ticker

    </script>


    =========================
    FILE ESTERNO messaggi.xml
    =========================

    <?xml version="1.0"?>
    <xmlticker>
    <pause>3000</pause>
    <message>Ecco le news del giorno:</message>
    <message url="http://www.html.it/news7.html">Arrestati i fondatori di Mediaclick</message>
    <message url="http://www.html.it/news2.html" target="_blank">Bene l'online banking in Europa</message>
    <message url="http://www.html.it/news3.html">HP: i bilanci premiano la fusione con Compaq</message>
    </xmlticker>

    =========================

    Ho provato ad inserire questo codice all'interno di style ma non funziona:
    A{color:#ffffff; text- decoration:none};A:hover{color:red};A:visited:{col or:#ffffff};

    Qualcuno mi aiuta?
    Grazie
    News In Web - il social news per tutti
    --> https://www.newsinweb.net <--

  2. #2
    Utente di HTML.it
    Registrato dal
    Jan 2002
    Messaggi
    633
    Alcuni miei articoli in PRO.HTML.IT: JavaScript | DHTML | DOM
    Sviluppo : wedev | forum

  3. #3
    Grazie, davvero molto gentile.
    Spero di risolvere il problema, altrimenti ti faccio sapere.
    A presto.
    News In Web - il social news per tutti
    --> https://www.newsinweb.net <--

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.