模式窗体,第一种
Windows.showModalDialog(“跳转的路径”,“”,dialog Width=700px;dialogHeight=520px)模式窗体,
//代码的使用情况在进一步了解中。
function SearchShop() { if (window.showModalDialog != null)//IE判断 { var returnValue = window.showModalDialog("SMSMemberChose.aspx", "", "dialogWidth=700px;dialogHeight=520px"); if (returnValue != null) { document.getElementById("txtPhone").value = returnValue; } return; } else { this.returnAction = function(returnValue) { if (returnValue != null) { document.getElementById("txtPhone").value = returnValue; } } } window.open("SMSMemberChose.aspx", "", "height=700px,width=520px"); return; }
模式窗体第二种:
Wiondows.showModalDialog
“交收地{[^点]}”替换 ” 交收地点\1” 找含有 “交收地“的不带 “ 点“ 字的关键字。替换成交收地点
Js 实现全选功能
首先查找控件的属性是[input]的值,循环input的个数,从中取出类型是:checkbox的。
开始判断input的id是否等于id名字,并且判断他是否选中没。如果选中了,控件选中的形式显示。如果判断input的id是等于id名字,且没有选中以无选中形式显示。
具体实现方法:
<script type="text/javascript">
var Counts = 0;
var contractNo = "";
function setAllChekc(obj) {
var objs = document.getElementsByTagName("input"); //找到input的值
for (var i = 0; i < objs.length; i++) {
if (objs[i].type.toLowerCase() == "checkbox") {
if (obj.checked) {
if (objs[i].id != "allChose" && !objs[i].checked) {
objs[i].checked = true;
Counts++;
//ContractNo=ContractNo.replace(objs[i].value+",",'');
}
} else {
if (objs[i].id != "allChose" && objs[i].checked) {
objs[i].checked = false;
Counts--;
//ContractNo =ContractNo.replace(obj.value+",",'');
}
}
}
}
document.getElementById("lblMsg").innerHTML = Counts;
// document.getElementById("hfRequest").value = ContractNo; //把值赋给隐藏控件
}
function addValue(obj) {
// var obj = document.getElementById("allChose");
var objs = document.getElementsByTagName("input");
if (obj.checked) {
Counts++;
for (var i = 0; i < objs.length; i++) {
if (objs[i].type.toLowerCase() == 'checkbox') {
if (objs[i].checked) {
// document.getElementById("allChose").checked = false;
}
}
}
} else {
Counts--;
for (var i = 0; i < objs.length; i++) {
if (objs[i].type.toLowerCase() == 'checkbox') {
// toLowerCase 把大小写统一转换成小写的。
if (!objs[i].checked) {
// document.getElementById("allChose").checked = false;
}
}
}
}
document.getElementById("lblMsg").innerHTML = "选中了" + Counts + "标的";
}
</script>
<form id="form1" runat="server">
<div>
<span style="color: Red">选中了:<asp:Label ID="lblMsg" runat="server" Text="">0</asp:Label>项</span>
<asp:GridView ID="grd" runat="server" AutoGenerateColumns="False" BackColor="White"
BorderColor="#CC9966" BorderStyle="None" BorderWidth="1px" CellPadding="4" Width="462px">
<RowStyle BackColor="White" ForeColor="#330099" />
<Columns>
<asp:TemplateField>
<HeaderTemplate>
<input id="allChose" onclick="setAllChekc(this)" type="checkbox" />
</HeaderTemplate>
<ItemTemplate>
<input id="cbChose" onclick="addValue(this)" runat="server" value='<%#Eval("tId") %>'
type="checkbox" />
</ItemTemplate>
<ItemStyle HorizontalAlign="Center" />
</asp:TemplateField>
<asp:BoundField HeaderText="编号" DataField="tId" />
<asp:BoundField HeaderText="栏目名字" DataField="tName" />
</Columns>
<FooterStyle BackColor="#FFFFCC" ForeColor="#330099" />
<PagerStyle BackColor="#FFFFCC" ForeColor="#330099" HorizontalAlign="Center" />
<SelectedRowStyle BackColor="#FFCC66" Font-Bold="True" ForeColor="#663399" />
<HeaderStyle BackColor="#990000" Font-Bold="True" ForeColor="#FFFFCC" />
</asp:GridView>
</div>
</form>
<style type="text/css">
#ctl00_tdMenu ul *
{
margin: 0px;
padding: 0px;
}
#ctl00_tdMenu ul li
{
float: left;
text-align: center;
100px;
list-style: none;
margin-left: 8px;
margin-right: 15px;
margin-top: 10px;
cursor: pointer;
}
#ctl00_tdMenu ul li a
{
font-size: 14px;
color: black;
font-weight: bold;
text-decoration: none;
}
#ctl00_tdMenu ul li a:hover
{
font-size: 14px;
color: black;
font-weight: bold;
text-decoration: none;
position: relative;
top: 1px;
}
.divmenu
{
margin-top: 15px;
clear: left;
margin-left:150px;
margin-right:150px;
background-color:Green;
}
.divFlash
{
margin-top:50px;
clear:left;
600px;
background-color:White;
height:200px;
}
</style>
<%-- .navmenu
{
100%;
}
.navmenu li
{
float: left;
100px;
text-align: center;
display: block;
height: 30px;
line-height: 30px;
}--%>
设置文章详细页面字体(大中小)效果
<script type="text/javascript">
//设置字体 by hk 2007-3-9
function SetFont(size) {
var divBody = document.getElementById("news_content");
if (!divBody) {
return;
}
divBody.style.fontSize = size + "px";
var divChildBody = divBody.childNodes;
for (var i = 0; i < divChildBody.length; i++) {
if (divChildBody[i].nodeType == 1) {
divChildBody[i].style.fontSize = size + "px";
}
}
}
</script>
页面调用方法
字体大小:<a href="javascript:SetFont(16)" class="fontsizea">[大]</a>
<a href="javascript:SetFont(14)" class="fontsizea">[中]</a>
<a href="javascript:SetFont(12)" class="fontsizea">[小]</a>
Style=”cursor:pointer”鼠标点到目标是成手装显示