比别人多付出5%的努力,将换来200%的收获!
用javascript操纵页面元素,想给制定的Element添加Attribute,用了
posted on 2006-09-26 01:31 windy的木头 阅读(1491) 评论(2) 编辑 收藏 所属分类: JavaScript
'日付 フォーマット を チェック Me.txt_date.Attributes.Add("onblur", "dealDate('" & Me.txt_date.ClientID & "')") '登録ボタンを確認する Me.btn_update.Attributes("onclick") = "return confirm('登録しますか?');" 回复 引用 查看
IE并不是不支持setAttribute这个函数,而是不支持用setAttribute设置某些属性,例如对象属性、集合属性、事件属性,也就是说用setAttribute设置className ,style和onclick这些属性在IE中是行不通的为达到兼容各种浏览器的效果,可以用点符号法来设置Element的对象属性、集合属性和事件属性。document.getElementById("foo").className = "fruit";document.getElementById("foo").style.cssText = "color: #00f;";document.getElementById("foo").style.color = "#00f";document.getElementById("foo").onclick= function () { alert("This is a test!"); } 回复 引用
昵称: [登录] [注册]
主页:
邮箱:(仅博主可见)
验证码: 看不清,换一个
评论内容:
登录 注册
[使用Ctrl+Enter键快速提交评论]