Visualizzazione dei risultati da 1 a 5 su 5

Discussione: Links in Javascript

  1. #1

    Links in Javascript

    Vorrei sapere se posso cambiare l'url e il testo di un link usando la classe documento: document.links[k].qualcosa = "Ciao" ed eventualmente quali parametri devo usare. Grazie
    I'm your dreams, make you real... I'm your eyes when you must steel...I'm pain when you can't feel...sad but true !

  2. #2
    Utente di HTML.it L'avatar di Mods
    Registrato dal
    Jun 2004
    Messaggi
    302
    così come dici te non saprei. Però vai sul sicuro se dai un id al collegamento

    roba

    e poi fai

    document.getElementById("nome_a").href="nuovo_url"

  3. #3
    Ok grazie, proverò in questo modo... solo che io devo cambiare non solo l'href ma anche il nome del link. Penso comunque che si possa fare nello stesso modo...
    I'm your dreams, make you real... I'm your eyes when you must steel...I'm pain when you can't feel...sad but true !

  4. #4
    Utente di HTML.it L'avatar di Xinod
    Registrato dal
    Sep 2000
    Messaggi
    13,649
    puoi provare con
    document.getElementById("nome_a").innerHTML="nuovo testo"

    ciao

  5. #5
    Perfetto ! Funziona, grazie mille !
    I'm your dreams, make you real... I'm your eyes when you must steel...I'm pain when you can't feel...sad but true !

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.