w执行顺序。
ok
<!doctype html>
<html>
<head>
<meta charset="UTF-8">
</head> <body> <form action="" method="post" id="amz_reviews" style="display: inline;">
<button type="submit" name="type"
value="amz_reviews" <?php if (!isset($_COOKIE['wjs_cookie']) || (isset($_COOKIE['wjs_cookie']) && $_COOKIE['wjs_cookie'] == 'amz_reviews')) echo 'style=" background-color:red;" '; ?>
onclick="w('amz_reviews')">差评
</button>
</form> <form action="" method="post" id="amz_similar_sellers" style="display: inline;">
<button type="submit"
name="type" <?php if (isset($_COOKIE['wjs_cookie']) && $_COOKIE['wjs_cookie'] == 'amz_similar_sellers') echo 'style=" background-color:red;" '; ?>
value="amz_similar_sellers"
onclick="w('amz_similar_sellers')">跟卖
</button>
</form> <form action="" method="post" id="amz_listing" style="display: inline;">
<button type="submit"
name="type" <?php if (isset($_COOKIE['wjs_cookie']) && $_COOKIE['wjs_cookie'] == 'amz_listing') echo 'style=" background-color:red;" '; ?>
value="amz_listing"
onclick="w('amz_listing')">评分、类目变化
</button>
</form>
</body>
</html>
<script>
document.cookie = 'wjs_cookie=' + 'amz_reviews'; function w(id) {
document.cookie = 'wjs_cookie=' + id;
document.getElementById(id).submit();
} console.log(document.cookie);
</script>
ok
<script>
document.cookie = 'wjs_cookie=' + 'amz_reviews'; function w(id) {
document.cookie = 'wjs_cookie=' + id;
document.getElementById(id).submit();
} console.log(document.cookie);
</script>
<!doctype html>
<html>
<head>
<meta charset="UTF-8">
</head> <body> <form action="" method="post" id="amz_reviews" style="display: inline;">
<button type="submit" name="type"
value="amz_reviews" <?php if (!isset($_COOKIE['wjs_cookie']) || (isset($_COOKIE['wjs_cookie']) && $_COOKIE['wjs_cookie'] == 'amz_reviews')) echo 'style=" background-color:red;" '; ?>
onclick="w('amz_reviews')">差评
</button>
</form> <form action="" method="post" id="amz_similar_sellers" style="display: inline;">
<button type="submit"
name="type" <?php if (isset($_COOKIE['wjs_cookie']) && $_COOKIE['wjs_cookie'] == 'amz_similar_sellers') echo 'style=" background-color:red;" '; ?>
value="amz_similar_sellers"
onclick="w('amz_similar_sellers')">跟卖
</button>
</form> <form action="" method="post" id="amz_listing" style="display: inline;">
<button type="submit"
name="type" <?php if (isset($_COOKIE['wjs_cookie']) && $_COOKIE['wjs_cookie'] == 'amz_listing') echo 'style=" background-color:red;" '; ?>
value="amz_listing"
onclick="w('amz_listing')">评分、类目变化
</button>
</form>
</body>
</html>
Notice: Undefined index: wjs_cookie
<script>
document.cookie = 'wjs_cookie=' + 'amz_reviews'; function w(id) {
document.cookie = 'wjs_cookie=' + id;
document.getElementById(id).submit();
} console.log(document.cookie);
</script>
<!doctype html>
<html>
<head>
<meta charset="UTF-8">
</head> <body> <form action="" method="post" id="amz_reviews" style="display: inline;">
<button type="submit" name="type"
value="amz_reviews" <?php if ($_COOKIE['wjs_cookie'] == 'amz_reviews') echo 'style=" background-color:red;" '; ?>
onclick="w('amz_reviews')">差评
</button>
</form> <form action="" method="post" id="amz_similar_sellers" style="display: inline;">
<button type="submit"
name="type" <?php if ($_COOKIE['wjs_cookie'] == 'amz_similar_sellers') echo 'style=" background-color:red;" '; ?>
value="amz_similar_sellers"
onclick="w('amz_similar_sellers')">跟卖
</button>
</form> <form action="" method="post" id="amz_listing" style="display: inline;">
<button type="submit"
name="type" <?php if ($_COOKIE['wjs_cookie'] == 'amz_listing') echo 'style=" background-color:red;" '; ?>
value="amz_listing"
onclick="w('amz_listing')">评分、类目变化
</button>
</form>
</body>
</html>
Notice: Undefined index: wjs_cookie
<!doctype html>
<html>
<head>
<meta charset="UTF-8">
</head>
<script>
document.cookie = 'wjs_cookie=' + 'amz_reviews'; function w(id) {
document.cookie = 'wjs_cookie=' + id;
document.getElementById(id).submit();
} console.log(document.cookie);
</script>
<body> <form action="" method="post" id="amz_reviews" style="display: inline;">
<button type="submit" name="type"
value="amz_reviews" <?php if ($_COOKIE['wjs_cookie'] == 'amz_reviews') echo 'style=" background-color:red;" '; ?>
onclick="w('amz_reviews')">差评
</button>
</form> <form action="" method="post" id="amz_similar_sellers" style="display: inline;">
<button type="submit"
name="type" <?php if ($_COOKIE['wjs_cookie'] == 'amz_similar_sellers') echo 'style=" background-color:red;" '; ?>
value="amz_similar_sellers"
onclick="w('amz_similar_sellers')">跟卖
</button>
</form> <form action="" method="post" id="amz_listing" style="display: inline;">
<button type="submit"
name="type" <?php if ($_COOKIE['wjs_cookie'] == 'amz_listing') echo 'style=" background-color:red;" '; ?>
value="amz_listing"
onclick="w('amz_listing')">评分、类目变化
</button>
</form>
</body>
</html>
Notice: Undefined index: wjs_cookie
<!doctype html>
<html>
<head>
<meta charset="UTF-8">
</head>
<body>
<script>
document.cookie = 'wjs_cookie=' + 'amz_reviews'; function w(id) {
document.cookie = 'wjs_cookie=' + id;
document.getElementById(id).submit();
} console.log(document.cookie);
</script>
<form action="" method="post" id="amz_reviews" style="display: inline;">
<button type="submit" name="type"
value="amz_reviews" <?php if ($_COOKIE['wjs_cookie'] == 'amz_reviews') echo 'style=" background-color:red;" '; ?>
onclick="w('amz_reviews')">差评
</button>
</form> <form action="" method="post" id="amz_similar_sellers" style="display: inline;">
<button type="submit"
name="type" <?php if ($_COOKIE['wjs_cookie'] == 'amz_similar_sellers') echo 'style=" background-color:red;" '; ?>
value="amz_similar_sellers"
onclick="w('amz_similar_sellers')">跟卖
</button>
</form> <form action="" method="post" id="amz_listing" style="display: inline;">
<button type="submit"
name="type" <?php if ($_COOKIE['wjs_cookie'] == 'amz_listing') echo 'style=" background-color:red;" '; ?>
value="amz_listing"
onclick="w('amz_listing')">评分、类目变化
</button>
</form>
</body>
</html>