<script>
var temp= " ";
function chgTemp(arg)
{
temp=arg;
//alert(temp);
}
</script>
<select name="dd" style="height:20px; font-size:12px; width:150px;" onchange= "chgTemp(this.options[this.selectedIndex].value)">
<option value=1>1</option>
<option value=2>2</option>
<option value=3>3</option>
</select>
<a href="search.asp?=temp">ddd</a>
想把temp 值放在a连接中怎么写呢!
通过document.write的方式输出js变量。
1、定义js变量
<script>2、输出变量a
补充:
document.write()方法:向网页文档中输出了一段文字或者变量的值
start_city= 只是这样 不会出现value 的值
追答
然后你在js中
document.getElementById("value") = "你要赋的值";
(不是这里)
追答那更简单啊
js中的写法
document.getElementById("temp ").href = "search.asp?="+要赋的值;
不好使的 后面还有很多参数呢
追答那就是你没写好了
追问能给写个实例吗?
追答
window.onload = function (){
var value = "question/424727947.html#replyask-1035156936";
document.getElementById("temp").href = "http://zhidao.baidu.com/"+value;
}
百度知道