<a href=javascript:addItem("abc")>abc</a>
<a href=javascript:addItem("def")>def</a>
<select name=talkto></select>
<script>
function addItem(str){
with(document.all.talkto){
add(new Option(str,str))
length++
for(i=length-1;i>0;i--){options[i].text=options[i-1].text;options[i].value=options[i-1].value}
options[i].text=str;options[i].value=str
}
}
</script>
<a href=javascript:addItem("def")>def</a>
<select name=talkto></select>
<script>
function addItem(str){
with(document.all.talkto){
add(new Option(str,str))
length++
for(i=length-1;i>0;i--){options[i].text=options[i-1].text;options[i].value=options[i-1].value}
options[i].text=str;options[i].value=str
}
}
</script>
解决方案 »
- 如何拆
- 怎样在HTML中用javascript在浏览器显示如下的效果?
- js类 this关键字机制的疑问
- 使用target="order" 使打开的页面在同一窗口,怎么聚焦到那个页面?
- 求助:javascript 中变色的实现
- 这个效果该怎么做到?
- 请问:有没有什么调试javascript(dhtml)的工具?
- 如何设置text框使其无法输入,并且显示的字不是灰色的。是否有什么style或方法可是实现。我用<input type="text" style="ime-mode:disabl
- 怎样取一个字符串的前 4 个字符(该字符串前4个字符包括 中文、英文、[\|;',.]等)
- 请教一个比较简单的问题,关于如何勾选网站中的复选框的
- 求:颜色代码的转换。
- List双击怎么得到该List双击处的Name和Value
<a href=javascript:addItem("def")>def</a>
<select name=talkto></select>
<script>
function addItem(str){
with(document.all.talkto){
length++
for(i=length-1;i>0;i--){options[i].text=options[i-1].text;options[i].value=options[i-1].value}
options[i].text=str;options[i].value=str
}
}
</script>
<a href=javascript:addItem("abc")>abc</a>
<a href=javascript:addItem("def")>def</a>
<select name=talkto></select>
<script>
function addItem(str){
with(document.all.talkto){
add(new Option(str,str))
selectedIndex=length-1
}
}
</script>
<a href=javascript:addItem("def")>def</a>
<a href=javascript:addItem("ghi")>ghi</a>
<select name=talkto></select>
<script>
function addItem(str){
with(document.all.talkto){
length++
for(i=length-1;i>0;i--)
if(options[i-1].text==str)options[i-1].removeNode(true);
else{options[i].text=options[i-1].text;options[i].value=options[i-1].value}
options[i].text=str;options[i].value=str
}
}
</script>
right.htm
<html>
<head>
<meta name="GENERATOR" content="Microsoft FrontPage 5.0">
<meta name="ProgId" content="FrontPage.Editor.Document">
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<title>abc def ghi</title>
</head>
<body>
<a href=javascript:addItem("abc")>abc</a>
<a href=javascript:addItem("def")>def</a>
<a href=javascript:addItem("ghi")>ghi</a>
<script>
function addItem(str){
with(parent.left.document.all.talkto){
length++
for(i=length-1;i>0;i--)
if(options[i-1].text==str)options[i-1].removeNode(true);
else{options[i].text=options[i-1].text;options[i].value=options[i-1].value}
options[i].text=str;options[i].value=str
}
}
</script>
</body>
</html>
left.htm
<html>
<head>
<meta name="GENERATOR" content="Microsoft FrontPage 5.0">
<meta name="ProgId" content="FrontPage.Editor.Document">
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<title>新建网页 3</title>
</head>
<body>
<p><select size="1" name="talkto">
<option>所有人</option>
</select></p>
</body>
</html>