解决方案 »
- 久没写js,都用jquery。竟然连下面的代码都没达到我的效果,麻烦大家帮我看看
- js问题,虽常见,解决方案也多,但没几个能实现。
- js能做这种效果吗?
- JavaScript 获取浏览器用户设置语言
- 请高手帮我看看这个代码中如何才能得到select的值?
- replace替换字符串出错了,求帮忙~~~
- 怎样用javascript判断输入的用户名只能是英文和数字的结合?
- 求求你们帮帮我,为什么向text框传值有空格就行了?(在线等!拨号的!)
- 想在js中改变一个层的显示属性,下面的代码为什么不能成功??
- 这个字符串怎么付值?
- 求关闭其他窗口或弹窗代码
- 求一个JS的replaceChild的用法问题
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
</head>
<body>
<div id="apDiv1"> s | s | s | s |<br /> s | s</div>
<form id="form1" name="form1" method="post" action="">
<p>
<label>
<textarea name="txtgo" id="txtgo" cols="80" rows="10" ondblclick="Xiao();"></textarea>
</label>
</p>
<p>
<label>
<input type="button" name="b1" id="b1" onclick="kan();" value="观看" />
</label>
<label>
<input type="reset" name="b2" id="b2" value="清除" />
</label>
<label>
<input type="button" name="b2" id="b2" onclick="pastetxt();" value="粘贴" />
</label>
</p>
</form>
</body><script type="text/javascript">function Xiao()
{
document.getElementById("txtgo").ondblclick=function(){
this.select();
}
}function pastetxt()
{
var ta = document.getElementById("txtgo");//获取控件
ta.focus();//设置其焦点
ta.document.execCommand("paste"); // 粘贴
} function kan(){
var de=document.getElementById("apDiv1");
var oP,oTextNode,deDao,oB;
deDao=document.getElementById("txtgo").value;
oP=document.createElement("p");
oP.setAttribute("txt",deDao);
oP.innerHTML = deDao.replace(/\n/g, "<br />");
de.appendChild(oP);
de.style.visibility="visible";
document.getElementById("b1").disabled=true;
}
</script></html>
那就你指定的那个div层.innerHTML显示这些内容就行了~·
http://topic.csdn.net/u/20110816/23/398f6c53-cd2b-41c3-bd37-c72bdd75178f.html
<!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=utf-8" />
<title>无标题文档</title>
<script type="text/javascript" defer="defer">var s,arr = ['http://yzz.web.officelive.com/1.jpg',
'http://yzz.web.officelive.com/2.jpg',
'http://yzz.web.officelive.com/3.jpg',
'http://yzz.web.officelive.com/4.jpg',
'http://yzz.web.officelive.com/5.jpg'],count = 0;setInterval(function(){
if(arr[count]){
document.getElementById('imggg').src = arr[count];
count++;
if(count == 5){
count = 0;
}
}
},2000);function i1(s){
this.s=s;
document.getElementById("imggg").src="http://yzz.web.officelive.com/1.jpg";
count = 0;
}
function i2(s){
this.s=s;
document.getElementById("imggg").src="http://yzz.web.officelive.com/2.jpg";
count = 1;
} function i3(s){
this.s=s;
document.getElementById("imggg").src="http://yzz.web.officelive.com/3.jpg";
count = 2;
}function i4(s){
this.s=s;
document.getElementById("imggg").src="http://yzz.web.officelive.com/4.jpg";
count = 3;
}
function i5(s){
this.s=s;
document.getElementById("imggg").src="http://yzz.web.officelive.com/5.jpg";
count = 4;
} function ddd(){
if(s==undefined) s="http://www.baidu.com/";
window.open(s);
}
</script>
</head><body>
<table width="212" border="0" cellspacing="0">
<tr>
<td><img id="imggg" src="http://yzz.web.officelive.com/1.jpg" width="220" onclick="ddd();" height="141" /></td>
</tr>
<tr>
<td><a id="img1" href="#" onclick="i1('http://www.baidu.com/');">1</a> <a id="img2" href="#" onclick="i2('http://www.163.com/');">2</a> <a href="#" onclick="i3('http://www.ali213.net')">3</a> <a href="#" onclick="i4('http://www.library.hn.cn/')">4</a> <a href="#" onclick="i5('http://www.gougou.com')">5</a></td>
</tr>
</table></body>
</html>