*说明:select元素javascript常用操作
* 1.判断是否存在指定value的Item
* 2.加入一个Item
* 3.删除值为value的所有Item
* 4.删除某一个index的选项
* 5.更新第index项的value和text
* 6.设置select中指定text的第一个Item为选中
* 7.设置select中指定value的第一个Item为选中
* 8.得到当前选中项的value
* 9.得到当前选中项的index
* 10.得到当前选中项的text
* 11.清空所有选项
-------------------------------------------------------*/
//1.判断是否存在指定value的Item
function ExistValue(obj,value){
for(var i=0;i<obj.options.length;i++){
if(obj.options[i].value == value){
return true;
}
}
return false;
}
//2.加入一个Item
function AddItem(obj,text,value){
var varItem = new Option(text,value);
obj.options.add(varItem);
}
//3.删除值为value的所有Item
function RemoveItems(obj,value){
for(var i=0;i<obj.options.length;i++){
if(obj.options[i].value == ItemValue){
obj.options.remove(i);
}
}
}
//4.删除 ......
// 下拉列表类
// PubEdition: Version 1.0.0.0
// ModifyDate: 2009-12-09 9:30:00
// FinishDate: 2009-12-09 9:30:00
// AuthorName: binbin( Mail:pl45@163.com / Tel:13893302154 )
var droplistswap=function(){};
droplistswap.prototype.originalElement=new Array();
// droplistswap.prototype.hidedroplist=function(evt){
// var my = this;
// var _event = window.event?window.event:evt;
// var obj = _event.toElement?_event.toElement:_event.relatedTarget;
// while( obj!=null && obj.id!="droplistElement"){
// obj = obj.parentNode;
// }
// if(obj==null)document.getElementById("droplistElement").style.display="none";
// }
droplistswap.prototype.initialize=function(DropID,index){
var my = this;
my.originalElement.push(document.getElementById(DropID));
var selectElement=document.createElement('div');
selectElement.innerHTML="<label>"+document.getElementById(DropID).options[document.getElementById(DropID).selecte ......
前台页面为 子页面为一个按钮:
<form id="form1" runat="server">
<div>
<asp:Button runat="server" ID="Bt_Add" Text="添加" Width="80px" Height="20px" OnClick="Bt_Add_Click" />
</div>
</form>
在后台onClick中添加:
protected void Bt_Add_Click(object sender, EventArgs e)
{
//你要做的事情然后刷新父页面
//刷新父页面
ClientScript.RegisterStartupScript(this.GetType(), "ReLoad", "ReLoad();", true);
}
在子页面加入javascript脚本
<script type="text/javascript" language="javascript">
function ReLoad() {
if(window.opener)
{//如果父页面还在的话
&nb ......
<script language="JavaScript" type="text/javascript">
<!--
// 说明:用 JavaScript 实现网页图片等比例缩放
// 整理:http://www.CodeBit.cn
function DrawImage(ImgD,FitWidth,FitHeight)
{
var image=new Image();
image.src=ImgD.src;
if(image.width>0 && image.height>0)
{
if(image.width/image.height>= FitWidth/FitHeight)
{
& ......
今天要向大家推荐9款很棒的可在网页中绘制图表的JavaScript脚本,这些有趣的JS脚本可以帮助你快速方便的绘制图表(线、面、饼、条…),其中包括jQuery、MooTools、Prototype和一些其它的JavaScript框架。
您还可以参考以下JavaScript/CSS相关教程及资源:
《精选30个优秀的CSS技术和实例
》
《300+Jquery, CSS, MooTools 和 JS的导航菜单资源
》
1.Flot
Flot
是基于 jQuery框架绘制图表的纯Javascript框架。它可在客户端即时绘制并生成各种图形。重要的是它使用简便(还有很多可选的设置)、吸引人的视觉效果和交互功能,如图表缩放和鼠标跟踪等。该javascript框架适用于我们所熟知的 Internet Explorer 6/7/8, Firefox 2.x+, Safari 3.0+, Opera 9.5+ and Konqueror 4.x+浏览器。 查看图表样例
2.JS Charts
JS Chart
是需要一些简单或无需手工书写编码的基于Javascript的免费图表生成器。使用JS Chart可以很简单很容易的完成你的生成图表任务,因为你只需要使用客户端脚本(即浏览器端),无需多余的插件或服务器端模块。你只需要准备好JS Chart脚本、包含图表数据的XML或Javascript数组,你的图表就准备就绪 ......
最近在学习javascript,对于如何运行调试却不了解。以为在记事本中编辑好文件后保存为htm文件,然后在浏览器中打开就可以了,但我试了多次都不成功,后来终于发现原来我在记事本中编辑保存的文件的后缀名为“.txt”。
解决方法:“文件夹选项”-->“查看”-->“高级设置”-->“隐藏已知文件类型的扩展名”去掉前面的勾,就可以看清楚文件的类型了。
要调试javascript可以使用office word中的一个免费工具,在安装office的时候自定义选择一个有关“html”的那个选项,这样在安装目录下就有了“D:\Program Files\Microsoft Office\OFFICE11\MSE7.EXE”文件,使用该文件即可进行javascript的调试。 ......