定义<input name="objName" id="objID" value="" onFoucs="setParamater();">
<script>
setParamater=function(){
...
...
...}
</script>如何通过setParamater()方法来改变input组件中的ID属性值
<script>
setParamater=function(){
...
...
...}
</script>如何通过setParamater()方法来改变input组件中的ID属性值
解决方案 »
- juqery hover做的菜单延时问题
- TAB选项卡代码请教
- 鼠标移过显示大图的问题
- jquery中slideup和slidedown的用法中的疑问?(在线等,妈上给分)
- 各位大虾 ,小弟才刚刚学习javascript 请问 如果我用鼠标拉动窗口,改变大小,会触发javascript的什么事件啊?谢谢!!
- 读取xml节点的奇怪问题
- MzTreeView 1.0 问题,如何得到选中的节点。或者如何给节点赋click事件。
- 关于表格变色的问题
- 谁有ACTIVEX 的相关学习资料(文章),提供就给分。谢谢!
- 请问在.css文件里,如何加注释,谢谢
- 哪里能搞到js所有保留字,内置对象,方法列表?
- 模态窗体打开模态窗体问题
<span id="span"/>
<script>
var setParamater=function(){
this.id="objID2";
document.getElementById('span').innerText=this.id;
}
</script>
<input name="objName" id="objID" value="" onfocus="setParamater();"/>
<span id="span"/>
<script>
setParamater=function(){
this.id="objID2";
document.getElementById('span').innerText=this.id;
}
</script>
setParamater=function(){this.id="abcd";
alert(document.getElementById("abcd"));
}
</script>
你可以试下这段代码,就知道能不能修改了
<HTML>
<HEAD>
<TITLE> New Document </TITLE>
<META NAME="Generator" CONTENT="EditPlus">
<META NAME="Author" CONTENT="">
<META NAME="Keywords" CONTENT="">
<META NAME="Description" CONTENT="">
</HEAD><BODY>
<input name="objName" id="objID" value="" />
<span id="span"/>
<script>
alert(document.getElementById("objId").id)
document.getElementById("objId").id = "asdfa";
alert(document.getElementById("asdfa").id)
</script>
</BODY>
</HTML>
<input type="button" onclick="document.getElementById('span').innerText=(this.previousSibling.nodeType==3)?this.previousSibling.previousSibling.id:this.previousSibling.id" value="button"/>
<span id="span" />
<script>
var setParamater=function(obj,newid){
obj.id=newid;
}
</script> 不知道LZ的意思到底是什么,我改了一下,LZ测一下看看是不是这样
晕,LZ,你的方法名错了,所以有问题,看红色
<input name="objName" id="objID" value="" onfocus="setParamater(this,'objID2');"/>
<input type="button" onclick="alert(document.getElementById('objID2').value);" value="button"/>
<span id="span" />
<script>
var setParamater=function(obj,newid){
obj.id=newid;
}
</script>
<input name="objName" id="objID" value="" onFoucs="setParamater();">
<script>
setParamater=function(){
var ctrlObjName = document.getElementByName('objName');
if(ctrlObjName.length>0)
{
ctrlObjName.[0].id = "objID2";
}
}
</script>