我正在使用此脚本来允许用户更改背景颜色...
document.onclick = function SetFavColor(e) {
if (e.target.className == 'AvcGbtn') {
var favColor = e.target.style.backgroundColor;
localStorage.setItem('color', favColor);
document.body.style.backgroundColor = favColor;
console.log(favColor);
}
};
document.addEventListener('DOMContentLoaded', function GetFavColor() {
var favColor = document.body.style.backgroundColor;
var color = localStorage.getItem('color');
if (color === '') {
document.body.style.backgroundColor = favColor;
} else {
document.body.style.backgroundColor = color;
}
});
Run Code Online (Sandbox Code Playgroud)
CSS:
body {
max-width: 100%;
min-width: 100%;
height: 100%;
font-family: normal;
font-style: normal;
font-weight: normal;
background-color: transparent;
}
.AvcGbtn {
display: inline-block;
width: 2em;
height: 2em;
}
Run Code Online (Sandbox Code Playgroud)
HTML:
<span …Run Code Online (Sandbox Code Playgroud) 所以在我的网站上我使用谷歌自定义搜索引擎,当我搜索示例'youtub'而不是'youtube'it显示为一个建议(显示结果为youtube - 搜索而不是youtub)或(你的意思是:youtube)
所以当我点击文本youtube时,我想将它添加到我的搜索框中,我该怎么做?这是我的代码
searchbox .html
<form action="" method="GET" id="searchform">
<input required="" type="search" name="q" id="searchbox" placeholder="Search..." title="Search..." enableAutoComplete="true" autofocus/>
<button><div class="Search-Button"><img src="MYIMGHERE" class="search-png"/></div></button>
</form>
Run Code Online (Sandbox Code Playgroud)
.js文件
<script type="text/javascript">
(function() {
var cx = '007072537540236505002:fsvzbpwgtgc';
var gcse = document.createElement('script');
gcse.type = 'text/javascript';
gcse.async = true;
gcse.src = 'https://cse.google.com/cse.js?cx=' + cx;
var s = document.getElementsByTagName('script')[0];
s.parentNode.insertBefore(gcse, s);
})();
var urlParams = new URLSearchParams(window.location.search);
document.getElementById('searchbox').value = urlParams.get('q');
</script>
<gcse:searchresults-only linktarget="_self"></gcse:searchresults-only>
Run Code Online (Sandbox Code Playgroud)
我的问题不是很明确,因为我找不到合适的词语!我很抱歉.
当复选框被选中克隆正确的股利,并显示在例如:<div id="favorite"></div>当复选框未选中删除克隆,伴随着localStorage.有人可以帮我解决这个问题吗?
function onClickAvGamesCheckBox() {
var arr = $('.AvGamesCheckBox').map(function() {
return this.checked;
}).get();
localStorage.setItem("checked", JSON.stringify(arr));
}
$(document).ready(function() {
var arr = JSON.parse(localStorage.getItem('checked')) || [];
arr.forEach(function(checked, i) {
$('.AvGamesCheckBox').eq(i).prop('checked', checked);
});
$(".AvGamesCheckBox").click(onClickAvGamesCheckBox);
});
//* Clone script
$(".avclone :checkbox").change(function() {
var name = $(this).closest("div").attr("name");
if (this.checked)
$(".columns[name=" + name + "]").clone().appendTo("#favorite");
else
$("#favorite .columns[name=" + name + "]").remove();
});Run Code Online (Sandbox Code Playgroud)
* {
box-sizing: border-box;
padding: 5px;
}
.AvGamesContainer {
display: block;
position: relative;
padding-left: 35px;
margin-bottom: 12px;
cursor: pointer; …Run Code Online (Sandbox Code Playgroud)如何在Google自定义搜索引擎(而非CSE面板)上设置手动过滤器?
例如,要在新选项卡中打开链接,我正在使用此代码:
<gcse:searchresults-only linktarget="_blank"></gcse:searchresults-only>
Run Code Online (Sandbox Code Playgroud)
现在我想设置"安全模式",并设置每页的结果(例如,显示10个结果).
为了更清楚,我想允许用户从我的网站更改这些过滤器,这就是我试图手动添加它们的原因!谢谢.
复选框默认选中不起作用!我试图修复它,但我找不到这里的错误在哪里?所以在页面加载被选中,在页面加载之后未被选中!?我试过了
<div class="onoffswitch" style="margin: 0 auto;">
<input type="checkbox" class="avacheckbox onoffswitch-checkbox" id="AvButtonAutoGames" checked="checked"/>
<label class="onoffswitch-label" for="AvButtonAutoGames">
<span class="onoffswitch-inner"></span>
<span class="onoffswitch-switch"></span>
</label>
</div>
Run Code Online (Sandbox Code Playgroud)
然后
<div class="onoffswitch" style="margin: 0 auto;">
<input type="checkbox" class="avacheckbox onoffswitch-checkbox" id="AvButtonAutoGames" checked/>
<label class="onoffswitch-label" for="AvButtonAutoGames">
<span class="onoffswitch-inner"></span>
<span class="onoffswitch-switch"></span>
</label>
</div>
Run Code Online (Sandbox Code Playgroud) 我想允许用户在chrome扩展示例文件夹名称(上传)上上传图像,并且没有提交按钮
<form action="/upload">
<input type="file" name="myimages" accept="image/*">
</form>
Run Code Online (Sandbox Code Playgroud)
显示图片
<span class="AvGbtn" id="AvBgIds" style="background-image: url(Here i want to show upload images url
); background-size: 100% 100%;" oncontextmenu="return false">
</span>
Run Code Online (Sandbox Code Playgroud) html javascript jquery firefox-addon google-chrome-extension
在这里阅读了很多文章后,我没有找到解决方案,所以我需要帮助才能做到这一点......我的网址就是那些例子:
主页
https://mywebsite.com/
https://mywebsite.com/al/
https://mywebsite.com/it/
https://mywebsite.com/videos/
https://mywebsite.com/al/videos/
https://mywebsite.com/it/videos/
https://mywebsite.com/news/
https://mywebsite.com/al/news/
https://mywebsite.com/it/news/
Run Code Online (Sandbox Code Playgroud)
询问
https://mywebsite.com/search/?q=YouTube
https://mywebsite.com/videos/search/?q=YouTube
https://mywebsite.com/news/search/?q=YouTube
https://mywebsite.com/al/search/?q=YouTube
https://mywebsite.com/al/videos/search/?q=YouTube
https://mywebsite.com/al/news/search/?q=YouTube
https://mywebsite.com/it/search/?q=YouTube
https://mywebsite.com/it/videos/search/?q=YouTube
https://mywebsite.com/it/news/search/?q=YouTube
Run Code Online (Sandbox Code Playgroud)
我的php和html改变了语言
<?php $Ava_Sulg = $_SERVER["REQUEST_URI"];?>
<a class="x" href="/<?php echo $Ava_Sulg;?>">EN</a>
<a class="x" href="/al<?php echo $Ava_Sulg;?>">AL</a>
<a class="x" href="/it<?php echo $Ava_Sulg;?>">IT</a>
Run Code Online (Sandbox Code Playgroud)
所以我允许用户更改他们的语言,什么我想要做的,是他们改变语言的URL可以是上述情况,例如之一,如果他们从改变语言AL to IT和url是https://mywebsite.com/al/videos/search/?q=YouTube与PHP我想这https://mywebsite.com/it/videos/search/?q=YouTube使我想改变这个url only(/al/ to /it/)或者exmaple from IT to EN(/it/ to Nothing)但是我要改变的是在中间,在主页上是不同的,对我来说很难,我怎么能做到这一点是可能的或者没有?如果可能的话,我希望在这里找到解决方案!非常感谢你.
从此 application/ld+json 我想获取示例 1.genre、2.director、3.dateCreated、4.duration、5.uploadDate
<script type="application/ld+json">{
"@context": "http://schema.org",
"@type": "Movie",
"url": "/title/tt2293640/",
"name": "Minions",
"image": "https://m.media-amazon.com/images/M/MV5BMTg2MTMyMzU0M15BMl5BanBnXkFtZTgwOTU3ODk4NTE@._V1_.jpg",
"genre": [
"Animation",
"Action",
"Adventure",
"Comedy",
"Family"
],
"contentRating": "PG",
"actor": [
{
"@type": "Person",
"url": "/name/nm0000113/",
"name": "Sandra Bullock"
},
{
"@type": "Person",
"url": "/name/nm0358316/",
"name": "Jon Hamm"
},
{
"@type": "Person",
"url": "/name/nm0000474/",
"name": "Michael Keaton"
},
{
"@type": "Person",
"url": "/name/nm1853544/",
"name": "Pierre Coffin"
}
],
"director": [
{
"@type": "Person",
"url": "/name/nm0049633/",
"name": "Kyle Balda"
},
{
"@type": "Person",
"url": …Run Code Online (Sandbox Code Playgroud) 我想$LinkOpen根据checkbox元素的当前状态更新PHP变量.avflipswitch.
基于.avflipswitch复选框状态,我想在我的PHP变量$LinkOpen之间切换'_blank','_self'因此我可以将该值推送到我的Google CSE链接目标属性.
到目前为止我尝试了什么:
$('.avflipswitch').on("change", function (e){
if(this.checked){
functionOne(<?php $LinkOpen = '_blank';?>);
}
else{
functionTwo(<?php $LinkOpen = '_self';?>);
}
});
<gcse:searchresults-only linktarget="<?php echo $LinkOpen;?>"></gcse:searchresults-only>
Run Code Online (Sandbox Code Playgroud)