JS里写入(混写)php
方法1:<Br>
<script language="javascript">
document.write("<?php echo
"阳光谢谢你"?>");
</script>
<Br>
<Br>
方法2<Br>
<script language="javascript">
<?php echo "alert(\"85谢谢你\");"?>;
<?php echo
"alert(‘85谢谢你‘);"?>;
</script>
案例三:
onclick="test(‘<?php
echo $con["p_name"]?>‘)"
<script language="javascript"
type="text/javascript">
<!--
function test(a){
alert(a);
location=‘Orderlist.php?name=‘+a;
}
//--></script>
或者:
onclick="window.location.href=‘Orderlist.php?name=‘+‘<?php
echo $con["p_name"]?>‘"
一个判断
<script
language="javascript">
<?php
$a=1;
if($a==1)
echo "alert(‘85谢谢你‘);"?>;
</script>
<script
language="javascript">
function check(){
<?php
if(!isset($_COOKIE[‘LoginId‘])){
echo "alert(‘请登录后下载‘);";
echo "return false;";}
else
echo "return true";
?>
}
</script>
"" 里的东西服务器会去解释
‘‘ ‘‘里的东西服务有可能不去解释,直接输出
在php里可以都 是字各个字符串
2、js混写ASP
<script
language="javascript">
<%
i=9
if(i=9) then
response.write "alert(‘85谢谢你‘);"
end if
%>
</script>