在我的应用程序中,我尝试打印出用户的凭证页面,我用过:
var htm ="<div>Voucher Details</div>";
$('#divprint').html(htm);
window.setTimeout('window.print()',2000);
Run Code Online (Sandbox Code Playgroud)
' divprint
' div
在我的页面中存储有关凭证的信息.
它工作正常,弹出打印页面.但是一旦用户点击' print
'或' close
'弹出窗口,我想进一步继续申请.
例如,我想在弹出窗口关闭后将用户重定向到另一个页面:
window.application.directtoantherpage();//a function which direct user to other page
Run Code Online (Sandbox Code Playgroud)
如何确定弹出打印窗口是关闭还是打印完成?
在ES6中,我们如何快速获得元素?
在MDN语法集中,我没有找到答案.
我正在尝试在React中实现List视图.我想要实现的是存储列表标题信息并注册组件并注册滚动事件.每当用户滚动窗口时,我想取出存储的div并重新计算offsetTop
数据.
现在的问题是,我发现控制台只打印出初始值(值固定且永不改变)offsetTop
数据在onscroll
功能上永远不会改变.
有人建议如何offsetTop
从_instances
对象中获取最新信息吗?
import React, { Component } from 'react';
import ListHeader from './lib/ListHeader';
import ListItems from './lib/ListItems';
const styles = {
'height': '400px',
'overflowY': 'auto',
'outline': '1px dashed red',
'width': '40%'
};
class HeaderPosInfo {
constructor(headerObj, originalPosition, originalHeight) {
this.headerObj = headerObj;
this.originalPosition = originalPosition;
this.originalHeight = originalHeight;
}
}
export default class ReactListView extends Component {
static defaultProps = {
events: ['scroll', 'mousewheel', 'DOMMouseScroll', 'MozMousePixelScroll', 'resize', 'touchmove', 'touchend'], …
Run Code Online (Sandbox Code Playgroud) 这是小提琴中的例子
我在Chrome中进行了测试,它显示正常,但在Firefox中,输入框大于预期.
这是什么原因?任何解决方案来解决这个问题?
这是html文件:
<div class="form-wrapper">
<input type="search" name="Ofsearch"
placeholder="Search here..." value=""/>
<button id="searchButton" type="submit">
Search
</button>
</div>
Run Code Online (Sandbox Code Playgroud)
CSS:
.form-wrapper {
height: 80px;
clear: both;
}
.form-wrapper input {
border-radius: 10px;
border: 5px solid #E5E4E2;
margin: 2px;
height: 40px;
vertical-align: middle;
padding: 20px;
margin-top: 15px;
width: 85%;
}
.form-wrapper button {
overflow: visible;
position: absolute;
float: right;
border: 0;
padding: 0;
height: 40px;
width: 110px;
border-radius: 0 3px 3px 0;
margin: 20px -118px;
}
Run Code Online (Sandbox Code Playgroud)
从示例中可以看出,在Chrome和FF中,它们显示的大小不同.
当我检查这个问题时,我发现填充:.form-wrapper input {}中的20px导致了这个问题.但是,当我删除它时,FF显示正常,但Chrome中的输入区域变小.只是想知道,任何方式使它在两个浏览器中显示相同.
我将输入字段的占位符字体颜色更改为蓝色,我在Chrome中测试过,它的颜色是蓝色.但在FF 23.0.1中,颜色比蓝色稍微"浅".
请参阅下面的对比,请注意"月"在一个范围内,颜色也是蓝色:
在Chrome中,它很好,见下文:
但是,在Firefox 23.0.1中,看起来像这样:
在IE8中,不显示:
注意颜色的差异.
以下是我正在使用的css代码:
.month_span { color: blue; }
.input::-webkit-input-placeholder { color:blue}
.input::-moz-placeholder { color:blue; } /* FF 19+ */
.input:-moz-placeholder { color:#bbb; } /* FF 18- */
.input:-ms-input-placeholder { color:#bbb; }
Run Code Online (Sandbox Code Playgroud)
我的问题:1.为什么FF的颜色较浅?2.如何在IE中显示占位符值?
我读过类似的问题,但我的问题略有不同.
我正在使用Kendo UI为网站实现单页注册处理页面.该网站有4个页面,这是用户单击菜单选项卡时动态生成的.例如,当用户单击菜单上的tab1时,则会tab_1
将其注入app_container
容器中.
模板如下:
<div id="app_container"></div>
<script id="tab_1" type="text/x-kendo-template">
//first page
</script>
<script id="tab_2" type="text/x-kendo-template">
//second page
</script>
<script id="tab_3" type="text/x-kendo-template">
//third page
</script>
<script id="tab_4" type="text/x-kendo-template">
//fourth page
</script>
Run Code Online (Sandbox Code Playgroud)
该页面位于域名下:www.xxxxxxxx.com/register.html
.
当用户单击菜单中的选项卡时,http链接地址更改为:
www.xxxxxxxx.com/register.html#/p1
www.xxxxxxxx.com/register.html#/p2
www.xxxxxxxx.com/register.html#/p3
www.xxxxxxxx.com/register.html#/p4
我抓住了GA的代码:
<script>
(function(i,s,o,g,r,a,m){i['GoogleAnalyticsObject']=r;i[r]=i[r]||function(){
(i[r].q=i[r].q||[]).push(arguments)},i[r].l=1*new Date();a=s.createElement(o),
m=s.getElementsByTagName(o)[0];a.async=1;a.src=g;m.parentNode.insertBefore(a,m)
})(window,document,'script','//www.google-analytics.com/analytics.js','ga');
ga('create', 'UA-XXXXXXX-1', 'xxxxxxxx.com');
ga('send', 'pageview');
</script>
Run Code Online (Sandbox Code Playgroud)
1)问题1,因为我只想跟踪这个注册页面,我已经阅读了google的文档,developers.google.com/analytics,这个代码会起作用吗?
ga('send', 'pageview', '/register.html');
Run Code Online (Sandbox Code Playgroud)
2)问题2,如何启用GA获取4个不同标签页的数据?我是否必须修改单击操作才能跟踪事件?或者只是简单地跟踪锚标签?我从Tracking Hash URL中读到了一些内容,这个代码是否适用于我的情况?由于显示分析可能需要一些时间,因此现在无法测试:
_gaq.push(['_trackPageview', "/" + window.location.hash]);
Run Code Online (Sandbox Code Playgroud)
如果它适用于这个单页应用程序,我应该把这行代码放在哪里?
html javascript jquery google-analytics single-page-application
我有一个div和背景颜色是红色.现在我想留下80%保持红色,在右边部分保持20%没有颜色或透明.是否可以仅在不添加更多div或更改div的填充的情况下更改css?我希望div保持原始尺寸.
我知道这是一个非常愚蠢的问题,但不知道为什么这不起作用:
this.getPageName = function(pagenum){
var name;
if(pagenum==1){
this.name='1.page1';
}
else if(pagenum==2){
this.name='2.page2';
}
else if(pagenum==3){
this.name='3.page3';
}
else if(pagenum==4){
this.name='4.page4';
}
console.log("pagenum: " + pagenum);
console.log("tabname: " + name);
return name;
}
var page=3;
var pagename=getPageName(page);
console.log(pagename);
Run Code Online (Sandbox Code Playgroud)
我想console.log(pagename);
会有3.page3
,但输出是undefined
.
哪里不对了?那里肯定有一些范围错误.
我的右边界是100%高度:
border-right:1px solid #000000;
Run Code Online (Sandbox Code Playgroud)
我想缩短它:
是否可以在不改变div高度的情况下使用CSS实现?我需要div为100%高度,只改变边界.
我试图通过使用ramda给定id删除对象,这是我的JSON数据格式:
{
id: 1,
name: "orders",
queries: [{
id: 120,
name: "test1",
queries: [{
id: 141,
name: "order1"
}]
}, {
id: 121,
name: "test2",
}, {
id: 115,
name: "test3",
}, {
id: 122,
name: "test4",
}, {
id: 125,
name: "test5",
queries: [{
id: 126,
name: "order2"
}]
}, {
id: 143,
name: "test6"
}, {
id: 144,
name: "test7"
queries: [{
id: 145,
name: "order3"
}]
}, {
id: 146,
name: "test8"
}]
}
Run Code Online (Sandbox Code Playgroud)
在上面的例子中,给定id: 141 …
我知道我们可以.style
像这样将 css 应用于 DOM 元素:
document.getElementById("test").style.color="red";
我想知道,是否可以应用样式对象,如下所示:
newStyle: {
position : 'fixed';
width : '300px';
height : '20px';
top : '0';
}
Run Code Online (Sandbox Code Playgroud)
如何newStyle
通过使用申请.style
,可以吗?(我们这里没有使用 jQuery)
我使用下面的插件来创建自动完成功能:
https://github.com/devbridge/jQuery-Autocomplete
以下是他们的现场演示:
http://www.devbridge.com/sourcery/components/jquery-autocomplete/#jquery-autocomplete
现在的问题是,我想过滤结果,只显示字母匹配开头的第一个字母.
例如,如果我键入'a',则只会出现以'a'开头的国家/地区.
我检查了这个插件的库,我看到那里有一个lookupFilter
函数,但不知道如何使用它.
是否有人曾经使用过这个库,然后才能给出一些指示?
我想使用这个插件而不是jQuery UI,因为它是轻量级的.
我有以下结构:
<li id="0" class="instruction">
<div class="row1">
title
</div>
<div class="row2 details hidden">
details
</div>
</li>
Run Code Online (Sandbox Code Playgroud)
隐藏的CSS是: display: none
我想当用户单击说明时,然后显示详细信息div。
$(document).ready(function () {
$(".instruction").click(function(e){
$(e).find('.details').removeClass("hidden");
});
});
Run Code Online (Sandbox Code Playgroud)
试图实现类似上面的内容,但是不起作用。任何的想法?
javascript ×8
css ×5
html ×5
jquery ×4
autocomplete ×1
css3 ×1
ecmascript-6 ×1
firefox ×1
offset ×1
ramda.js ×1
reactjs ×1
scroll ×1