我知道有很多关于这方面的问题,但没有什么能正确回答我.我想在用户离开页面时显示确认对话框.如果用户按下取消,他将保持在页面上,如果确定,他所做的更改将通过调用方法回滚.我这样做了:
window.onbeforeunload = function () {
var r = confirm( "Do you want to leave?" );
if (r == true) {
//I will call my method
}
else {
return false;
}
};
Run Code Online (Sandbox Code Playgroud)
问题是我正在获取浏览器默认弹出窗口:"LeavePage/StayOnPage"
此页面要求您确认是否要离开 - 您输入的数据可能无法保存.
此消息显示在Firefox中,在Chrome中有点不同.我在第一个确认对话框上按OK后弹出这个弹出窗口.
有没有办法不显示这个对话框?(第二个,我没有创建).或者,如果有任何方法可以控制此弹出窗口,有没有人知道如何做到这一点?谢谢
我研究了很多,我发现这个JSFiddle看起来像我需要的,但是,当我点击按钮时,页面背景正在改变.我想要在单击时更改按钮的颜色.
div{
width: 100%;
height: 100%;
background: #5CB85C;
position: absolute;
top: 0;
left: 0;
z-index:1;
}
label.btn {
position: absolute;
top:10px;
left: 10px;
z-index:2;
-webkit-touch-callout: none;
-webkit-user-select: none;
-khtml-user-select: none;
-moz-user-select: none;
-ms-user-select: none;
user-select: none;
}
input[type="checkbox"]{
display: none;
}
input[type="checkbox"]:checked + div{
background: #5BC0DE;
}
label + input[type="checkbox"]:checked{
background: #000;
}Run Code Online (Sandbox Code Playgroud)
<link href="http://netdna.bootstrapcdn.com/twitter-bootstrap/2.3.2/css/bootstrap-combined.min.css" rel="stylesheet"/>
<label for="check" class="btn btn-default">Toggle background colour</label>
<input type="checkbox" id="check" />
<div></div>Run Code Online (Sandbox Code Playgroud)
我有这个<div class='divname'>...</div>,我在许多其他页面中使用它.我们可以创建一个html文件并将其包含在aspx页面中,而不是重复此代码吗?如果有,怎么样?
我没有使用Masterpage,我的后端是vb.net
我的表列包含以下值:
id | item
-------------
1 | aaaa11a112
2 | aa1112aa2a
3 | aa11aa1a11
4 | aaa2a222aa
Run Code Online (Sandbox Code Playgroud)
我想只选择项目值以数字结尾的行.有这样的事吗?
select * from table where item like '%number'
Run Code Online (Sandbox Code Playgroud) 有很多方法可以将html表导出到excel,但是jtable怎么样,因为它不包含像<table>页面一样的html标签,它只是通过id来调用<div id="table"></div>
我有简单的解决方案,适用于Chrome,但不适用于IE
要导出的按钮:
<a id="dlink" onclick="tableToExcel('StudentTableContainer', 'name', 'TestExcelFile.xls')">Export to excel</a>
Run Code Online (Sandbox Code Playgroud)
JTable的:
<div id="StudentTableContainer"></div>
Run Code Online (Sandbox Code Playgroud)
使用Javascript:
var tableToExcel = (function () {
var uri = 'data:application/vnd.ms-excel;base64,'
, template = '<html xmlns:o="urn:schemas-microsoft-com:office:office" xmlns:x="urn:schemas-microsoft-com:office:excel" xmlns="http://www.w3.org/TR/REC-html40"><head><!--[if gte mso 9]><xml><x:ExcelWorkbook><x:ExcelWorksheets><x:ExcelWorksheet><x:Name>{worksheet}</x:Name><x:WorksheetOptions><x:DisplayGridlines/></x:WorksheetOptions></x:ExcelWorksheet></x:ExcelWorksheets></x:ExcelWorkbook></xml><![endif]--></head><body><table>{table}</table></body></html>'
, base64 = function (s) { return window.btoa(unescape(encodeURIComponent(s))) }
, format = function (s, c) { return s.replace(/{(\w+)}/g, function (m, p) { return c[p]; }) }
return function (table, name, filename) {
if (!table.nodeType) table = document.getElementById(table)
var ctx = …Run Code Online (Sandbox Code Playgroud) 转换占位符文本的问题 input type="text"
这是我的示例代码:
HTML:
<div id="google_translate_element" style="float:left; padding-left:15px"></div>
<!-- Need to translate this placeholder text -->
<form><input type="text" placeholder= "Enter your name" />
<input type="submit" value="Submit" />
</form>
Run Code Online (Sandbox Code Playgroud)
javascipt的:
<script type="text/javascript">
function googleTranslateElementInit() {
new google.translate.TranslateElement({pageLanguage: 'en', includedLanguages: 'ca,da,de,el,en,es,fr,it,ja,ko,nl,pl,pt,ru,sv,tl', layout: google.translate.TranslateElement.InlineLayout.SIMPLE}, 'google_translate_element');
}
</script>
<script type="text/javascript" src="//translate.google.com/translate_a/element.js?cb=googleTranslateElementInit"></script>
Run Code Online (Sandbox Code Playgroud)
CSS:
<style>
div#google_translate_element div.goog-te-gadget-simple{background-color:green;}
div#google_translate_element div.goog-te-gadget-simple a.goog-te-menu-value span{color:yellow}
div#google_translate_element div.goog-te-gadget-simple a.goog-te-menu-value span:hover{color:#ffffff}
</style>
Run Code Online (Sandbox Code Playgroud)
翻译的例子是在
的jsfiddle:
http://jsfiddle.net/ulak/zDUYL/
请提及使用谷歌翻译翻译占位符文本的任何其他方式
我有一种方法可以裁剪图像,但它保持比例,有时给我一个椭圆形的图像.有没有一种方法可以固定宽度和高度,同时不会使图像偏斜或变暗?即,120px x 120px?
有关如何修改此方法的任何想法吗?
注意: maxSize设置为120px.另外,我从原始图像传递宽度和高度.
protected function calculateSize($width, $height) {
if ($width <= $this->maxSize && $height <= $this->maxSize) {
$ratio = 1;
} elseif ($width > $height) {
$ratio = $this->maxSize / $width;
} else {
$ratio = $this->maxSize / $height;
}
$this->newWidth = round($width * $ratio);
$this->newHeight = round($height * $ratio);
}
Run Code Online (Sandbox Code Playgroud) 我在 imgur 上有一张图片。该图像显示在除本地主机之外的任何网站上。
可能是什么问题?
<img class="cover" src="https://i.stack.imgur.com/wqYLI.jpg" alt="">
Run Code Online (Sandbox Code Playgroud)
错误:GET https://i.stack.imgur.com/wqYLI.jpg 403(禁止)
我有一个响应式网站,当网站位于其他导航链接旁边的"桌面"视图(屏幕可用宽度> 768)时,它具有简单的下拉登录菜单.当屏幕宽度低于768时,导航链接最终会出现在选择选项中.问题是下拉登录菜单在选择选项中不起作用.
<a href>当屏幕宽度小于768时,我想使用PHP将下拉登录菜单更改为一个简单的链接.
现在我在我的页面中<head>:
<?
$screenWidth = '<script type="text/javascript">document.write(screen.availWidth);</script>';
?>
Run Code Online (Sandbox Code Playgroud)
在<body>:
<?
if($screenWidth <= "768") {
echo '<li><a href="login.php">Log in</a></li>';
} else {
?>
<div id="fancy">
<li id="login">
<a id="login-trigger" href="#">Log in <span>▼</span></a>
<div id="login-content">
<form>
<fieldset id="inputs">
<input id="username" type="email" name="Email" placeholder="Your email address" required>
<input id="password" type="password" name="Password" placeholder="Password" required>
</fieldset>
<fieldset id="actions">
<input type="submit" id="submit" value="Log in">
<label><input type="checkbox" checked="checked"> Keep me signed in</label>
</fieldset>
</form>
</div>
</li>
<? …Run Code Online (Sandbox Code Playgroud) 对于我推送的任何分支,我的代码都被部署到 FTP。
image: samueldebruyn/debian-git
pipelines:
default:
- step:
script:
- apt-get update
- apt-get -qq install git-ftp
- git ftp push --user $FTP_USERNAME --passwd $FTP_PASSWORD ftp://ftp.example.com/path/to/website
Run Code Online (Sandbox Code Playgroud)
如何为不同的分支创建多个管道?
就像测试分支到testing/path,部署分支到deploy/path。