focus:获取焦点
select:突出显示表单元素的输入区域
选中并聚焦 为document.selection.createRange().text
获取值做准备
2. onclick="javascript:testxy()" 就可以了
实在不行你就换一个实现方式:
1:拿到select对象: var myselect=document.getElementById("test")
2:拿到选中项的索引:var index=myselect.selectedIndex // selectedIndex代表的是你所选中项的index
3:拿到选中项options的value: myselect.options[index].value
4:拿到选中项options的text: myselect.options[index].text
再把需要的值给hidden input就可以了
<!DOCTYPE html><html>
<body>
<input type="file" id='up' oninput="get()" />
<script>
function get() {
let fup = document.getElementById('up')
console.log("本地文件路径:" + fup.value)
}
</script>
</body>
</html>
123456789101112<style type="text/css">.file-box{ position:relativewidth:340px} .txt{ height:22px border:1px solid #cdcdcd width:200pxborder-right:none} .btn{ background-color:#FFF border:1px solid #CDCDCDheight:26px width:70px} .file{ position:absolute top:0 right:80px height:24px filter:alpha(opacity:0)opacity: 0width:260px }</style><div class="file-box"> <form action="" method="post" enctype="multipart/form-data"> <input type='text' name='textfield' id='textfield' class='txt' /><input type='button' class='btn' value='浏览...' /> <input type="file" name="fileField" class="file" id="fileField" size="28" onchange="document.getElementById('textfield').value=this.value" /> </form> </div>
要这样写才是对的。
1、超文本标记语言,标准通用标记语言下的一个应用。 “超文本”就是指页面内可以包含图片、链接,甚至音乐、程序等非文字元素。 超文本标记语言的结构包括“头”部分(英语:Head)、和“主体”部分(英语:Body),其中“头”部提供关于网页的信息,“主体”部分提供网页的具体内容。
2、在WWW上的一个超媒体文档称之为一个页面(page)。作为一个组织或个人在万维网上开始点的页面称为主页Homepage,或首页,主页中通常包括有指向其他相关页面或其他节点的指针(超级链接)。在逻辑上将视为一个整体的一系列页面的有机集合称为网站(Website或Web)。Web页面也就是通常所说的网页,在这里不作区分。