在windows.location中插入变量href不起作用

时间:2016-04-17 13:39:48

标签: javascript php

在php中找到一些示例,但在javascript中找不到 但它不工作,我有搜索在网上找不到任何我尝试的例子,但我坦克所以我的方式是不正确我的所有代码:

我已经尝试过几种不同的方式,但我还是没有让这段代码正常工作



window.location.href = "<?php echo $up1; ?>"
&#13;
&#13;
&#13;

&#13;
&#13;
<?php
$up1 = $row['up1'];
session_start();
include_once 'dbconnect.php';

if(!isset($_SESSION['user']))
{
	header("Location: index.php");
}
mysql_real_escape_string($user_id);
mysql_real_escape_string($user_name);
mysql_real_escape_string($user_points);
mysql_real_escape_string($user_voucher);
mysql_real_escape_string($user_level);
mysql_real_escape_string($user_wallet);
$res=mysql_query("SELECT up1 FROM settings");
$userRow=mysql_fetch_array($res);
$up1 = $up1;

?>
<!DOCTYPE html>
<html>
<head>
<div  id='exemple' data-up='<?php echo $up1;?>'>
 </div>
<script type='text/javascript'>
document.onkeydown = function (e) {
  var key = e.charCode || e.keyCode;
  if (key == 13) { 
    // enter key do nothing
  } else {
    e.preventDefault();
  }	     
}
</script>

<script>
        window.oncontextmenu = function () {
            console.log("Right Click Disabled");
            return false;
        }


    </script>



<script type="text/javascript"> 
function disableselect(e){  
return false  
}  

function reEnable(){  
return true  
}  

//if IE4+  
document.onselectstart=new Function ("return false")  
document.oncontextmenu=new Function ("return false")  
//if NS6  
if (window.sidebar){  
document.onmousedown=disableselect  
document.onclick=reEnable  
}
</script>


<meta charset=utf-8 />
<title>JS Bin</title>
</head>
<body>
<script>
function goToBing() {
 //window.location.href = "<?php echo $up1; ?>"
var test=$("#exemple").attr('data-up);
   window.location.href=test;
}
</script>
<br>
<br>
<br>
<br>
<center><a href="http://bitcoinrotator.publiadds.org.pt" onclick="goToBing();return false;">Click To Confirm Please</a></center>
</body>
</html>
&#13;
&#13;
&#13;

0 个答案:

没有答案