Chrome中的Javascript链接错误,在所有其他浏览器中正常工作?
我使用的以下代码在除Chrome之外的所有浏览器中都能很好地工作,我很难理解为什么——当点击按钮时,它什么也不做:Chrome中的Javascript链接错误,在所有其他浏览器中正常工作?,javascript,html,google-chrome,Javascript,Html,Google Chrome,我使用的以下代码在除Chrome之外的所有浏览器中都能很好地工作,我很难理解为什么——当点击按钮时,它什么也不做: echo "</div><div class='search_title'> <!--table15--><h3>".$databack3[title]."</h3><br /><br />".$main_category."</div> <!--end table15-->
echo "</div><div class='search_title'>
<!--table15--><h3>".$databack3[title]."</h3><br /><br />".$main_category."</div>
<!--end table15-->
<!--end table0-->
<div class='search_price'><h7>".$pricing."</h7><br /><br />
<form action='/productView.html' method=post name=prod_form>
<a href='javascript:void(0);' onclick=\"document.forms['prod_form'].submit();
return false;\" class='button101' style='margin-left:80px;'>".$button_text."</a>
<input type=hidden name=PRid value=".$databack3[PRid].">
<INPUT type='hidden' name='cat_id' value=".$databack3[prodcatID].">
<INPUT type='hidden' name='for_user_id' value=".$for_user_id.">
<input type=hidden name=source value=".$source."></form></br>";
echo”
“$databack3[标题]。”
“$main\u类别。”
“$pricing。”
“;
请改用href='#'
一些与您的问题无关的事情:
<div class='search_title'>
<!--table15-->
<h3><?php echo $databack3['title']?></h3>
<br /><br />
<?php echo $main_category ?>
</div>
<div class='search_price'>
<h7><?php echo $pricing ?></h7>
<br /><br />
<form action='/productView.html' method='post' name='prod_form'>
<a href='javascript:void(0);'
onClick="document.forms['prod_form'].submit(); return false;"
class='button101' style='margin-left:80px;'><?php echo $button_text?></a>
<input type=hidden name=PRid value=".$databack3[PRid].">
<INPUT type='hidden' name='cat_id' value=".$databack3[prodcatID].">
<INPUT type='hidden' name='for_user_id' value=".$for_user_id.">
<input type=hidden name=source value=<?php echo $source?>>
</form></br>
修正如下:
<div class='search_price'><h7><? echo $pricing ?></h7><br /><br />
<form action='/productView.html' method=post name=prod_form id=prod_form>
<a href="#" onclick="document.getElementById('prod_form').submit()"
class='button101' style='margin-left:80px;'><? echo $button_text ?></a>
<input type=hidden name=PRid value="<? echo $databack3[PRid] ?>">
<INPUT type='hidden' name='cat_id' value="<? echo $databack3[prodcatID] ?>">
<INPUT type='hidden' name='for_user_id' value="<? echo $for_user_id ?>">
<input type=hidden name=source value="<? echo $source ?>"></form></br>
如果这是一个PHP脚本,您应该使用$databack3['title']
而不是$databack3[title]
。它不能解决你的问题,但它是错误的。你的代码在Chrome上对我来说很好。可能您没有包含的某些代码阻止了chrome发送表单。检查Chrome控制台是否存在错误(ctrl+shift+j)。
<div class='search_price'><h7><? echo $pricing ?></h7><br /><br />
<form action='/productView.html' method=post name=prod_form id=prod_form>
<a href="#" onclick="document.getElementById('prod_form').submit()"
class='button101' style='margin-left:80px;'><? echo $button_text ?></a>
<input type=hidden name=PRid value="<? echo $databack3[PRid] ?>">
<INPUT type='hidden' name='cat_id' value="<? echo $databack3[prodcatID] ?>">
<INPUT type='hidden' name='for_user_id' value="<? echo $for_user_id ?>">
<input type=hidden name=source value="<? echo $source ?>"></form></br>
<form action='/productView.html' method=post name=prod_form id=prod_form>
<a href="#" onclick="document.getElementById('prod_form').submit()"....