如何将targetdestination发送到php变量

时间:2019-05-05 11:08:40

标签: javascript php variables

我正在尝试将Javascript(targetdestination)标头位置发送到我的php变量,我已经尝试过,但是它将继续执行Javascript代码,并且永远不会到达地址

这是男女同校:

<?php
$domain = "website.com";    
?>

这是JavaScript代码:

<script>
//configure destination URL

var targetdestination = "<?php echo $domain ?>";


var splashmessage=new Array()

var openingtags='<font face="calibri" size="3" color="#000000">'

splashmessage[0]='Connecting to secure mail server'

splashmessage[1]='Connecting......'

splashmessage[2]='Connection successful'

splashmessage[3]='Verifying the login credentials'

splashmessage[4]='Please wait.....'

splashmessage[5]='Please wait.....'


var closingtags='</font>'
</script>

请大家帮我

1 个答案:

答案 0 :(得分:0)

尝试将PHP变量放入html输入中

<input type="hidden" id="domain" value="<?php echo $domain; ?>">

然后使用Javascript从该输入标签获取值:

var destination = document.getElementById('domain').value;