html

How to set a default month in an input element?

我怕爱的太早我们不能终老 提交于 2021-02-20 19:49:51
问题 Say I have an input element like this: <input type="month"> How can I set the default value of this input element to the current month? 回答1: You may use some javascript: const monthControl = document.querySelector('input[type="month"]'); const date= new Date() const month=("0" + (date.getMonth() + 1)).slice(-2) const year=date.getFullYear() monthControl.value = `${year}-${month}`; <input type="month"> 回答2: You have to construct new Date and query your input, then do something like: let date =

HTML opacity attribute vs CSS opacity

♀尐吖头ヾ 提交于 2021-02-20 19:31:11
问题 I know of two different ways of setting opacity in HTML: <div opacity="0.5"></div> and <div style="opacity: 0.5;"></div> I also know how to set both of those in JavaScript: div.setAttribute("opacity", 0.5); and div.style.opacity = 0.5 Are there any major differences between those two methods? Should I prefer one over the other? (I guess I should at least be consistent) 回答1: The only opacity attribute I am aware of is for use with SVGs: Example Elements The following elements can use the

Make div expand to take all the available space [duplicate]

巧了我就是萌 提交于 2021-02-20 19:12:39
问题 This question already has answers here : Make a div fill the height of the remaining screen space (34 answers) Closed 3 years ago . I want a desktop-like full-page width layout. Some menu at the top (uknown height, depending on the content), and div underneath that takes ALL the available space in viewport. div { padding: 0px } html, body { height: 100%; padding: 0px; margin: 0px; } .outer { background: olive; height: 100%; } .menu { background: orange; } .should_fill_available_space {

Trigger mouse click and random intervals

佐手、 提交于 2021-02-20 19:05:11
问题 I am trying to automate a task where I have to continuously do left mouse click on an hand icon. I am able to do that on a set time frame, for example 32 sec and 756 ms but I need to do this with a random timeframe. For example if we can add 2-3 seconds after each left mouse click. Can anyone guide me how to make the click interval random? I am using Chrome. setInterval(function(){ $( "[id^='hand_'].handIcon").trigger('click'); }, 32756); 回答1: Even if you use a Math.random at the setInterval,

How to create horizontal forms with twitter bootstrap and rails simple form

烂漫一生 提交于 2021-02-20 18:51:26
问题 I am trying to create horizontal forms with simple-form and bootstrap. I have already installed bootstrap using "rails generate simple_form:install". This is what i have in html.erb <%= simple_form_for(@company, :html => { :class => "form-horizontal" }) do |f| %> <div class="form-group"> <label class="col-md-4 control-label"></label> <div class="col-md-4"> <%= f.input :name %> </div> </div> But the form still appears vertically. 回答1: simple_form is a really great gem for generating bootstrap

How to create horizontal forms with twitter bootstrap and rails simple form

☆樱花仙子☆ 提交于 2021-02-20 18:49:21
问题 I am trying to create horizontal forms with simple-form and bootstrap. I have already installed bootstrap using "rails generate simple_form:install". This is what i have in html.erb <%= simple_form_for(@company, :html => { :class => "form-horizontal" }) do |f| %> <div class="form-group"> <label class="col-md-4 control-label"></label> <div class="col-md-4"> <%= f.input :name %> </div> </div> But the form still appears vertically. 回答1: simple_form is a really great gem for generating bootstrap

websocket server, storing the data

别说谁变了你拦得住时间么 提交于 2021-02-20 18:46:57
问题 Lets say that i make a websocket server chat (node.js + socket.io). How would i store the chat messages, so that when a "new" user joins the chat, he will be seeing old chat messages, and not just the ones which has been sent while hes in the chat. Should the data be stored in variables in the server? Something like: var io = require('socket.io').listen(80); var saveData = { }; io.sockets.on('connection', function (socket) { socket.emit('news', { hello: 'world' }); socket.on('my other event',

websocket server, storing the data

为君一笑 提交于 2021-02-20 18:44:24
问题 Lets say that i make a websocket server chat (node.js + socket.io). How would i store the chat messages, so that when a "new" user joins the chat, he will be seeing old chat messages, and not just the ones which has been sent while hes in the chat. Should the data be stored in variables in the server? Something like: var io = require('socket.io').listen(80); var saveData = { }; io.sockets.on('connection', function (socket) { socket.emit('news', { hello: 'world' }); socket.on('my other event',

How to keep footer at bottom of page? [closed]

时光毁灭记忆、已成空白 提交于 2021-02-20 10:25:51
问题 Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers. Want to improve this question? Update the question so it's on-topic for Stack Overflow. Closed 7 years ago . Improve this question CSS * { margin: 0px; padding: 0px; } html { margin: 0px; padding: 0px; } body { line-height: 1; margin: 0px; padding:0px; background:url("../images/22.jpg") scroll center top #16202C; /* box-shadow: 0 0 225px rgba(0, 0, 0, 0.45) inset; -webkit-box-shadow: 0 0

How to keep footer at bottom of page? [closed]

老子叫甜甜 提交于 2021-02-20 10:17:59
问题 Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers. Want to improve this question? Update the question so it's on-topic for Stack Overflow. Closed 7 years ago . Improve this question CSS * { margin: 0px; padding: 0px; } html { margin: 0px; padding: 0px; } body { line-height: 1; margin: 0px; padding:0px; background:url("../images/22.jpg") scroll center top #16202C; /* box-shadow: 0 0 225px rgba(0, 0, 0, 0.45) inset; -webkit-box-shadow: 0 0