我正在以两种不同的格式在数据库中插入日期.
这是作为Datetime插入
var mydate;
mydate = new Date();
document.getElementById('clockinhour').value = mydate.toISOString().slice(0, 19).replace('T', ' ');
Run Code Online (Sandbox Code Playgroud)
输出A.
2017-06-21 20:14:31
Run Code Online (Sandbox Code Playgroud)
这是作为varchar插入:
document.getElementById('clocked_in_time').value = Date();
Run Code Online (Sandbox Code Playgroud)
输出B.
Wed Jun 21 2017 16:14:31 GMT-0400 (Eastern Standard Time)
Run Code Online (Sandbox Code Playgroud)
输出B是正确的时间但我需要显示输出A.什么原因导致转换为ISOString时的时间变化?我怎样才能解决这个问题?
我需要允许用户使用Stripe输入自定义金额.他们输入他们想要输入的内容.然后我有一个脚本收集默认条带结帐按钮下面的金额.但我该如何处理服务器端的服务charge.php呢?
donation.php
//user enter custom amount
<input type="number" class='form-control'
id="custom-donation-amount"
placeholder="$50.00" min="0" step="10.00 " />
//default stripe checkout button
<script
src="https://checkout.stripe.com/checkout.js" class="stripe-button"
data-key="pk_test_XXXXXXXXXXXXXXX"
data-amount="0"
data-name="ORGANIZATION"
data-description="Saving Penguins"
data-image="logo.png"
data-locale="auto"
data-zip-code="true"
data-billing-address="true"
data-label="DONATE"
data-currency="usd">
</script>
//script to collect variable amount
<script type="text/javascript">
$(function() {
$('.donate-button').click(function(event) {
var amount = $('#custom-donation-amount').val();
$('.stripe-button').attr('data-amount', amount)
});
});
</script>
Run Code Online (Sandbox Code Playgroud)
charge.php
<?php require_once('./config.php');
$token = $_POST['stripeToken'];
$email = $_POST['stripeEmail'];
$customer = \Stripe\Customer::create(array(
'source' => $token,
'email' => $email)
);
$charge = \Stripe\Charge::create(array(
'customer' => …Run Code Online (Sandbox Code Playgroud) 我有响应式css选项卡,我用它以优雅的方式显示信息,但当用户刷新页面时,它会返回到第一个检查输入.我想知道如何保持页面上选择的用户按钮刷新他之前选择的用户按钮.我写了一个脚本,但似乎没有用.
标签
<input class="inputabs" id="tab1" type="radio" name="tabs" checked="checked">
<label class="labeltabs" for="tab1">Inbox</label>
<input class="inputabs" id="tab2" type="radio" name="tabs" >
<label class="labeltabs"for="tab2">Important</label>
<input class="inputabs" id="tab3" type="radio" name="tabs">
<label class="labeltabs" for="tab3">Bin</label>
Run Code Online (Sandbox Code Playgroud)
脚本
<script>
$(document).ready(function(){
$('.inputabs input[type="radio"]').each(function(){
$(this).attr("checked",$(this).checked());
}
);
</script>
Run Code Online (Sandbox Code Playgroud) 我正在尝试基于表单输入制作一个实时计算器,当我使用一个示例div它可以工作,但当我尝试在输入中打印总数时,我似乎错过了一些东西......
工作加价解决方案:
<input id='first' type="text" class="form-control formBlock" name="bus_ticket" placeholder="Bus Ticket..." required/><br />
<input id='second' type="text" class="form-control formBlock" name="plane_ticket" placeholder="Plane Ticket..." required/><br />
<input id='third' type="text" class="form-control formBlock" name="hotel_expenses" placeholder="Hotel Expenses..." required/><br />
<input id='fourth' type="text" class="form-control formBlock" name="eating_expenses" placeholder="Eating Expenses..." required/><br />
Total : <span id="total_expenses"></span>
Run Code Online (Sandbox Code Playgroud)
工作脚本
$('input').keyup(function(){ // run anytime the value changes
var firstValue = parseFloat($('#first').val()); // get value of field
var secondValue = parseFloat($('#second').val()); // convert it to a float
var thirdValue = parseFloat($('#third').val());
var fourthValue = …Run Code Online (Sandbox Code Playgroud)