Timer myTimer = new Timer();
final Handler uiHandler = new Handler();
final TextView txtResult = (TextView) findViewById(R.id.вашid);
myTimer.schedule(new TimerTask() {
@Override
public void run() {
Calendar calendar = Calendar.getInstance();
SimpleDateFormat simpleDateFormat = new SimpleDateFormat("dd:MMMM:yyyy HH:mm:ss a", Locale.getDefault());
final String strDate = simpleDateFormat.format(calendar.getTime());
uiHandler.post(new Runnable() {
@Override
public void run() {
txtResult.setText(strDate);
}
});
});
}, 5000);
<div class="class">
<p></p>
<p></p>
<img src="image.jpg" />
</div>
.class p:nth-child(2){
font-weight: bold;
}
<form id="sendForm">
<input type="text" size="40" name="sub">
<input type="text" size="40" name="text">
<input type="submit" value="GET IT">
</form>
window.addEventListener('DOMContentLoaded', function(){
var form = document.querySelector('#sendForm');
form.addEventListener('submit', function (e) {
e.preventDefault();
sendMail(this.elements.sub.value, this.elements.text.value);
}, false);
}, false);
(function(w, d){
var childOf = function (child, parent) {
while((child=child.parentNode) && child!==parent);
return !!child;
};
var initApp = function() {
var activeTab,
menu = d.querySelector('#menu'),
firstLevel = menu.children || [],
ln = firstLevel.length;
var tabClickHandler = function (e) {
e.preventDefault();
if (!activeTab) {
activeTab = this;
} else {
activeTab.classList.remove('active');
activeTab = this;
}
this.classList.add('active');
};
var innerTabClickHandler = function (e) {
e.preventDefault();
e.stopPropagation();
if (activeTab) {
activeTab.classList.remove('active');
}
};
var closeMenuHandler = function (e) {
var target = e.target || e.srcElement;
if(!childOf(target, menu)) {
if (activeTab) {
activeTab.classList.remove('active');
}
}
};
if (!ln) return;
while(ln--) {
var tab = firstLevel[ln],
secondLevel = tab.querySelectorAll('ul > li') || [],
lnS = secondLevel.length;
tab.addEventListener('click', tabClickHandler, false);
while(lnS--) {
var innerTab = secondLevel[lnS];
innerTab.addEventListener('click', innerTabClickHandler, false);
}
}
d.addEventListener('click', closeMenuHandler, false);
};
w.addEventListener('DOMContentLoaded', initApp);
}(window, document));
$(document).on('click', '.news h2 a', function(){
$(this).parent('h2').parent('.news').children('.text_from_news').slideToggle();
return false;
});
var Comp1 = React.createClass({
//code
render: function() {
return (
<div>
<Comp2 data={this.state.data} />
</div>
);
}
});
var Comp2 = React.createClass({
render: function() {
return (
var fromOne = this.props.data;
<div>
{fromOne}
</div>
);
}
});
$("input[type=text]").each(function() {
var input = $(this), id = this.id;
input.attr('name', id);
});
$(document).ready(function() {
$('.scroll-pane').jScrollPane({
autoReinitialise: true
});
});
['fonts-concat', 'fontmin']
gulp.task('fonts', ['fonts-concat'] function() {
return gulp.src('./fonts/*.css', {read: false})
.pipe(clean());
});
import {Dispatcher} from 'flux';
export default new Dispatcher();
import AppDispatcher from './AppDispatcher.js';
export default {
firstAction(){
AppDispatcher.dispatch({
actionType: 'FIRST__ACTION'
});
},
secondAction(){
AppDispatcher.dispatch({
actionType: 'SECOND__ACTION'
});
}
}
import AppDispatcher from './AppDispatcher.js';
export default class AppStore {
constructor() {
AppDispatcher.register(function (action) {
switch (action.actionType) {
case 'FIRST__ACTION':
//Первое действие
break;
case 'SECOND__ACTION':
//Второе действие
break;
}
});
}
}