Vale, ahora tengo todo puesto para que coja el valor del textarea, la guarde en la variable mensaje y cambie en el data-text el mensaje.
Pero no me funciona. En vez del mensaje escrito en el textarea, me sale
undefined
No sé si hice algo mal...
Te pego todo el body del HTML:
Código HTML:
<body>
<form name="formulario">
<textarea name="twitteando" id="twitteando" rows="5" cols="40" maxlength="99"></textarea>
</form>
<a href="https://twitter.com/share" id="twitterComment" class="twitter-share-button" data-url="http://www.extremafm.com" data-text="Escuchando la mejor musica 24 horas" data-via="RadioExtremaFM" data-lang="es" data-size="large" data-count="none" data-hashtags="">Twittear</a>
<script>!function(d,s,id){var js,fjs=d.getElementsByTagName(s)[0];if(!d.getElementById(id)){js=d.createElement(s);js.id=id;js.src="//platform.twitter.com/widgets.js";fjs.parentNode.insertBefore(js,fjs);}}(document,"script","twitter-wjs"); var mensaje = document.getElementById('twitteando').innerHTMLL; document.getElementById('twitterComment').setAttribute('data-text',mensaje);</script>
</body>
Gracias!