Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/javascript/361.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/ssl/3.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Javascript 发送反馈表_Javascript_Php_Html - Fatal编程技术网

Javascript 发送反馈表

Javascript 发送反馈表,javascript,php,html,Javascript,Php,Html,我有这张表格 对于star,有5个图像的onclick设置为functionstar1、functionstar2等。。。更改图像的url(有两个url star1.png(黄色)和star2.png(白色))。这是控制星星的脚本: <script>function functionStar1() { document.getElementById('star1').src = "star1.png"; document.getElementById('star2').src = "

我有这张表格

对于star,有5个图像的onclick设置为functionstar1、functionstar2等。。。更改图像的url(有两个url star1.png(黄色)和star2.png(白色))。这是控制星星的脚本:

<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>
函数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”;
}
函数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”;
}
函数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”;
}
函数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”;
}
函数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”;
}
我使用javascript发送信息,因为我需要使用以下脚本的星星url:

<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>
var密码;
蒂托洛变种;
var反馈;
var valutazione;
var-url;
函数open(){
密码=document.getElementById(“密码”).value;
titolo=document.getElementById(“titolo”).value;
反馈=document.getElementById(“反馈”).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=‘谨慎’;
}else if(document.getElementById('star3').src==
'http://www.***.eu/star1.png'){
valutazione=‘足够’;
}else if(document.getElementById('star2').src==
'http://www.***.eu/star1.png'){
valutazione=‘不充分’;
}否则{
valutazione=‘Pessimo’;
}
url='1〕http://www.***.eu/input.php?密码='+password+'&titolo='+
titolo+'&feedback='+feedback+'&valutazione='+valutazione;
document.getElementById(“ButtonRef”).href=url;
}
设置间隔(打开,10)

问题是它发送的
文本没有
\n
。是否有一种方法可以使用javascript获取带有
\n
的文本,或者更好的方法是否有一种方法可以在不使用javascript的情况下发送星星图像的url?

如果您不想使用javascript发送数据,uou可以设置一个隐藏值,该值会随着星星的数量而更新,然后在提交表单后进行处理

<input type="hidden" name="stars" value="5" id="stars-val" />

<script>
  function updateStarValue(starNum){ // star num is 1,2,3,4,5
  document.getElementByID("stars-val").val = starNum;
  }
</script>

函数updateSaveValue(starNum){//starNum是1,2,3,4,5
document.getElementByID(“stars val”).val=starNum;
}
然后在每个星号上,
onclick=updatesarvalue(2)

否则,请使用preg_replace将换行符更改为

检查以下内容: