js变量怎样加入超链接,望高手指点js变量 怎么赋值到页面的超链接望高手指点
解决方案 »
- [内附简单测试源码]js 获取值8-11 并限制 INPUT 各种事件 输入的值不能小于8 大于11
- onclick事件不响应,难道是function参数过多?
- javascript解析xml 遍历查询
- SHIFT+左键=左键实现
- 请问用JavaScript编写一个控制EDIT只能输入16个字符的程序如何编写??
- 高分请教小问题,望解答,谢谢,谢谢,谢谢... ...
- 一个prototype的问题。。
- 不用文本上传控件可以上传文件吗????急
- bootstrap swiitch 开关怎么设置value值
- ERROR in Entry module not found: Error: Can't resolve 'js/home.js' in 'C:\Users\
- 紧急求助
- css实现图片上传显示圆角效果
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312" />
<title>无标题文档</title>
</head><body>
<a href="http://www.126.com/" id="demolink">无标题文档</a>
<button onclick="foo();">click</button>
<script type="text/javascript">
var str="teststr";
function foo(){
document.getElementById('demolink').href+='?teststr';
}
</script>
</body>
</html>
<a href="#" id="link">待设置的超链接</a> document.getElementById('link').href = 'http://www.baidu.com';
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>Insert title here</title>
<script type="text/javascript">function btnClick() {
var container = document.getElementById('container');
var aLink = document.createElement('a');
aLink.href = 'http://www.sina.com.cn';
var textNode = document.createTextNode('新浪');
aLink.appendChild(textNode);
container.appendChild(aLink);
}
</script>
</head>
<body>
<input type="button" onclick="btnClick()"></input>
<div id="container"></div>
</body>
</html>这个??
function setHref(right){
document.getElementById('link').href = 'http://www.baidu.com?right='+right;
}
可以在这个函数里加多条语句,有几个link就加几条..
:)
<head>
<meta http-equiv="Content-Type" content="text/html; charset=big5" />
<title>Untitled Document</title>
</head><body>
<a id="link">Baidu</a>
</body>
</html>
<script>
document.getElementById("link").onclick=function(){setHref('','','_self','link');}
function setHref(url,param,target,el){
if(url=='') url='http://www.baidu.com/?';
if(url.indexOf('?')<0){
url += '?';
}
url += param;
if(el==''){
return;
}
var obj = eval("document.getElementById('" + el + "')"); if(obj == null || typeof(obj)=='undefined') return;
obj.target = target;
obj.href = url;
}
</script>
function link(id){
location.href = "login.php?id=" + id;
}