[英]How to create File open dialogue box in javascript that will show files on server?
[英]how can i show php variable value to a dialogue box using javascript
先生,我的项目有问题,我用PHP变量$sum
计算了某些东西的$sum
,现在我想在对话框中显示它的值,例如该特定东西的总和=使用Java脚本计算出的总和。这样做吗?这是我写的,它不起作用我该怎么办?其中sum1是我要在JavaScript对话框中打印的变量值,而size13到size24是我使用某些sql查询计算得出的。
index.php
<?php>
$sum1=$size13+$size14+$size15+$size16+$size17+$size18+$size19+$size20+$size21+$size22+$size23+$size24;
echo '<script type="text/javascript">
alert("Total Traffic-violation Solved During the year -2014-");
echo $sum1;
window.location=\'index.php\';</script>';
<?>
将警报更改为:
alert("Total Traffic-violation Solved During the year -2014-'.$sum1.'");
将总和连接到字符串中。
另外,您以<?php开头并以?>结尾,而不是<?php>和<?>-还是您使用的是非常奇怪的php解析器?
您应该使用下一行
alert("Total Traffic-violation Solved During the year -2014-'.$sum1.'");
尝试一下,在js alert()函数中使用$sum1
变量;
<?php>
$sum1=$size13+$size14+$size15+$size16+$size17+$size18+$size19+$size20+$size21+$size22+$size23+$size24;
echo '<script type="text/javascript">
alert("Total Traffic-violation Solved During the year -2014- '.$sum1.'");
window.location=\'index.php\';
</script>';
?>
要么
<script type="text/javascript">
alert("Total Traffic-violation Solved During the year -2014- <?php echo $sum1; ?>");
window.location=\'index.php\';
</script>
这将起作用:
<?php
$sum1 = 50;
echo '<script type="text/javascript">
alert("Total Traffic-violation Solved During the year -2014-: '.$sum1.'");
window.location=\'index.php\';
</script>';
?>
刚刚更改了您的金额等...
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.