1.如何让多个div排列在一行当中input
<input type="text" value="" style="width:25%;">
<input type="text" class="form-control" placeholder="sku" style="width:25%;float: left" maxlength="50">
<style>
.box1 {width:100px; float:left; display:inline;border:red 1px solid;}
.box2 {width:100px; float:left; display:inline;border:green 1px solid;}
</style>
<div class="container">
<div class="box1">121212</div>
<div class="box2">455656</div>
</div>
相关说明:
float 属性定义元素在哪个方向浮动。
可能的值
值 描述
left 元素向左浮动。
right 元素向右浮动。
none 默认值。元素不浮动,并会显示在其在文本中出现的位置。
inherit 规定应该从父元素继承 float 属性的值。
重点内容
这里写代码片
js问题
ps -ef | grep 8000 查看端口号占用情况
fa-calculator 计算器
1.js对象去空格
var a=document.getElementById("#name")
a.trim()去掉2端空格
a.ltrim()去掉左边空格
a.rtrim()去掉右边空格
2.转化为字符串
a.tostring()
1.value.toString()
2."" + value
3.String(value)
3.获取input的值
如何用jquery获取<input id="test" name="test" type="text"/>中输入的值?
$("#test").val()
$("input[name='test']").val()
$("input[type='text']").val()
$("input[type='text']").attr("value")
4.获取select 的值
js中获取方法
var obj = document.getElementByIdx_xx_x(”testSelect”); //定位id
var index = obj.selectedIndex; // 选中索引
var text = obj.options[index].text; // 选中文本
var value = obj.options[index].value; // 选中值
jQuery中获得选中select值
第一种方式
$('#testSelect option:selected').text();//选中的文本
$('#testSelect option:selected') .val();//选中的值
$("#testSelect ").get(0).selectedIndex;//索引
第二种方式
$("#tesetSelect").find("option:selected").text();//选中的文本
…….val();
…….get(0).selectedIndex;
6.js传参数
var numParameter = 123;
function sendParameter()
{
getParameter(numParameter );
}
function getParameter(sendNum)
{
alert(sendNum);
}
7.如何让输入的内容自动转为首字母大写的形式
<input name="htmer" type="text" onkeyup="this.value=this.value.toUpperCase()" />
<input type="text" style="*********; text-transform: uppercase;" name="textfield" />
数据库外键主键查询问题
在获取外键以后如何获取主键 待定
生成漂亮的警告弹窗
//产品上架
document.querySelector('ul.dropdown-menu li.ajax a').onclick = function() {
swal({
title: '确定要将该产品上架吗?',
text: "上架后可以进行销售!",
type: 'info',
showCancelButton: true,
closeOnConfirm: false,
showLoaderOnConfirm: true,
}, function(){
setTimeout(function() {
swal('产品上架成功!请刷新页面');
}, 2000);
});
};
//产品下架
document.querySelector('ul.dropdown-menu li.warning.confirm a').onclick = function(){
swal({
title: "确定要将该产品下架吗?",
text: "下架后可重新上架!",
type: "warning",
showCancelButton: true,
confirmButtonColor: '#DD6B55',
confirmButtonText: 'Yes, delete it!',
closeOnConfirm: false
},
function(){
swal("Deleted!", "产品下架成功!请刷新页面", "success");
});
};
//产品删除
document.querySelector('ul.dropdown-menu li.warning.cancel a').onclick = function(){
swal({
title: "确定要将该产品删除吗?",
text: "产品删除后将无法进行销售!",
type: "warning",
showCancelButton: true,
confirmButtonColor: '#DD6B55',
confirmButtonText: 'Yes, delete it!',
cancelButtonText: "No, cancel plx!",
closeOnConfirm: false,
closeOnCancel: false
},
function(isConfirm){
if (isConfirm){
swal("Deleted!", "产品成功删除!请刷新页面", "success");
} else {
swal("Cancelled", "产品继续为你保留!", "error");
}
});
};
获取选中的输入框 可以自主输入文字
<HTML>
<HEAD>
<META http-equiv='Content-Type' content='text/html; charset=utf-8'>
<TITLE>js实现可输入的下拉框</TITLE>
</HEAD>
<BODY>
<div style="position:relative;">
<span style="margin-left:100px;width:18px;overflow:hidden;">
<select style="width:118px;margin-left:-100px" onchange="this.parentNode.nextSibling.value=this.value">
<option value="德国">德国</option>
<option value="挪威">挪威</option>
<option value="瑞士"> 瑞士</option>
</select></span><input name="box" style="width:100px;position:absolute;left:0px;">
</div>
</BODY>
</HTML>
bootstrap基本css样式http://v2.bootcss.com/base-css.html