/
@see 鼠标点击拖拽的效果(页面可以同时拖动多个框)
@param boxId 整个对象(框)的id(一般为div或table)
@param event 内置对象(必须传入)
/
function mousePlead1(event, boxId) {
var o = getO(boxId);
var isIE = documentall true : false;
var e = event;
var x = eoffsetX || elayerX;
var y = eoffsetY || elayerY;
documentonmousemove = function(e) {
ostylefilter = 'Alpha(opacity=70)';
ostyleopacity = '07';
if (isIE) {
osetCapture();
} else {
windowcaptureEvents(EventMOUSEMOVE);
}
var e = windowevent || e;
if (eclientX - x >= 0 && eclientY - y >= 0 && eclientX - x <= getWinSize()[0] - getO(boxId)offsetWidth
&& eclientY - y <= getWinSize()[1] - getO(boxId)offsetHeight) {
ostyleleft = (eclientX - x) + "px";
ostyletop = (eclientY - y) + "px";
}
};
documentonmouseup = function(e) {
documentonmousemove = function() {
};
if (isIE) {
oreleaseCapture();
} else {
windowreleaseEvents(oMOUSEMOVE);
}
ostylefilter = "";
ostyleopacity = "";
};
}
/
@see 获得对象
@param id 对象的id(表单元素和其他标签都可以)
@return Object
/
function getO(id) {
return documentgetElementById(id);
}
/
@see 获得当前窗体的大小(width,height)
@return Array
/
function getWinSize() {
var width = parseInt(documentdocumentElementclientWidth);
var height = parseInt(documentdocumentElementclientHeight);
return new Array(width, height);
}
<input type="text" id="t" />
<input type="button" id="b" />
documentgetElementById('t')value=documentgetElementById('b')id;
<script type="text/javascript">
function buttonchange(obj)
{
var sum=parseInt(objid)+2;
alert(sum);
documentgetElementById(""+sum)value=objvalue;
}
</script>
<body>
<input name="3" type="button" id="5" value="改变" onclick="buttonchange(this)" />
<input name="3" type="button" id="7" value="" onclick="" />
</body>
我没有删除那个alert,你可以在你的程序里面试试看,因为objid+2的结果被解释为52,所以你会失败。
以上就是关于js怎样获取对象id值全部的内容,包括:js怎样获取对象id值、js获取button的id,并讲值赋给text、javascript如何通过id获取按钮,然后改变按钮的value值等相关内容解答,如果想了解更多相关内容,可以关注我们,你们的支持是我们更新的动力!
欢迎分享,转载请注明来源:内存溢出
评论列表(0条)