For the star there are 5 images with onclick set to functionstar1, functionstar2 etc... that change the url of the images (there are 2 url star1.png(yellow) and star2.png(white)). This is the script for the control of the stars:
<script>function functionStar1() {
document.getElementById('star1').src = "star1.png";
document.getElementById('star2').src = "star0.png";
document.getElementById('star3').src = "star0.png";
document.getElementById('star4').src = "star0.png";
document.getElementById('star5').src = "star0.png";
}
function functionStar2() {
document.getElementById('star1').src = "star1.png";
document.getElementById('star2').src = "star1.png";
document.getElementById('star3').src = "star0.png";
document.getElementById('star4').src = "star0.png";
document.getElementById('star5').src = "star0.png";
}
function functionStar3() {
document.getElementById('star1').src = "star1.png";
document.getElementById('star2').src = "star1.png";
document.getElementById('star3').src = "star1.png";
document.getElementById('star4').src = "star0.png";
document.getElementById('star5').src = "star0.png";
}
function functionStar4() {
document.getElementById('star1').src = "star1.png";
document.getElementById('star2').src = "star1.png";
document.getElementById('star3').src = "star1.png";
document.getElementById('star4').src = "star1.png";
document.getElementById('star5').src = "star0.png";
}
function functionStar5() {
document.getElementById('star1').src = "star1.png";
document.getElementById('star2').src = "star1.png";
document.getElementById('star3').src = "star1.png";
document.getElementById('star4').src = "star1.png";
document.getElementById('star5').src = "star1.png";
}</script>
I send information using javascript because i need the url of the star using this script:
<script>var password;
var titolo;
var feedback;
var valutazione;
var url;
function open(){
password = document.getElementById("password").value;
titolo = document.getElementById("titolo").value;
feedback = document.getElementById("feedback").value;
if (document.getElementById('star5').src == 'http://www.***.eu/star1.png') {
valutazione = 'Eccellente';
} else if (document.getElementById('star4').src ==
'http://www.***.eu/star1.png'){
valutazione = 'Discreto';
}else if (document.getElementById('star3').src ==
'http://www.***.eu/star1.png'){
valutazione = 'Sufficiente';
}else if (document.getElementById('star2').src ==
'http://www.***.eu/star1.png'){
valutazione = 'Non sufficiente';
} else {
valutazione = 'Pessimo';
}
url = 'http://www.***.eu/input.php?password=' + password + '&titolo=' +
titolo + '&feedback=' + feedback + '&valutazione=' + valutazione;
document.getElementById("buttonhref").href = url;
}
setInterval(open, 10)</script>
The problem is that it sends the <textarea>
text without the \n
. Is there a way to take the text with \n
using javascript or better is there a way to send the url of the star images without javascript?