87,907
社区成员
发帖
与我相关
我的任务
分享
<table>
<tr>
<td>address</td>
<td><input type="text" name="" id="add"></td>
</tr>
<tr>
<td>city</td>
<td><input type="text" name="" id="city"></td>
</tr>
<tr>
<td>zip</td>
<td><input type="text" name="" id="zip"></td>
</tr>
<tr>
<td>生成的链接:</td>
<td><input type="text" name="" id="contact"></td>
</tr>
<tr><td><input type="button" name="contact" value="contact" onclick="contact();"></td></tr>
</table>
<script type="text/javascript">
function contact(){
var add = document.getElementById("add").value;
var adds = add.split(" ").join("+");
var city = document.getElementById("city").value;
var zip = document.getElementById("zip").value;
var contact = document.getElementById("contact");
var contacts = "http://www.abc.com/?address=" + adds + "&city=" + city + "&zip=" + zip;
contact.value = contacts;
}
</script>
<input name="address" />
<input name="city" />
<input name="zip" />
<script>
var url='https://www.abc.com/?';
var o={
address:'',
city:'',
zip:''
};
[].slice.call(document.querySelectorAll('input')).forEach(function(item){
item.addEventListener('input',function(){
var value=item.value.replace(/\s+/g,'+');
var name=item.name;
o[name]=value;
var x=url;
var params=Object.keys(o).map(function(item){
return item+'='+o[item];
});
x+=params.join('&');
console.log(x);
},false)
})
</script>
page1
page2
//设置打印 <script language=javascript> function window.onload() { // -- advanced features factory.printing.SetMarginMeasure(2) // measure margins in inches factory.printing.SetPageRange(false, 1, 3) // need pages from 1 to 3 factory.printing.printer = "HP DeskJet 870C" factory.printing.copies = 2 factory.printing.collate = true factory.printing.paperSize = "A4" factory.printing.paperSource = "Manual feed" // -- basic features factory.printing.header = "居左显示&b居中显示&b居右显示页码,第&p页/共&P页" factory.printing.footer = "(自定义页脚)" factory.printing.portrait = false factory.printing.leftMargin = 0.75 factory.printing.topMargin = 1.5 factory.printing.rightMargin = 0.75 factory.printing.bottomMargin = 1.5 } function Print(frame) { factory.printing.Print(true, frame) // print with prompt }