var i=1;
var divzhanchun;
var step;
function creatediv()
{ var name='messagediv'+i;
var id='mes'+i;
var newdiv=document.createElement(name);
newdiv.id=id;
newdiv.innerText='你是不是想吃屎啊';
newdiv.style.top='300px';
newdiv.style.left='20px';
newdiv.position='absolute';
divzhanchun=newdiv;
newdiv.onclick=control(); document.body.appendChild(newdiv);
}function mandalpha()
{
// var time1;
// step=(500-parseInt(divzhanchun.style.left))/10;
step=parseInt(divzhanchun.style.left)+5; divzhanchun.style.offsetleft=step+'px';
}function control()
{
setInterval('mandalpha()',20);
}
var divzhanchun;
var step;
function creatediv()
{ var name='messagediv'+i;
var id='mes'+i;
var newdiv=document.createElement(name);
newdiv.id=id;
newdiv.innerText='你是不是想吃屎啊';
newdiv.style.top='300px';
newdiv.style.left='20px';
newdiv.position='absolute';
divzhanchun=newdiv;
newdiv.onclick=control(); document.body.appendChild(newdiv);
}function mandalpha()
{
// var time1;
// step=(500-parseInt(divzhanchun.style.left))/10;
step=parseInt(divzhanchun.style.left)+5; divzhanchun.style.offsetleft=step+'px';
}function control()
{
setInterval('mandalpha()',20);
}
解决方案 »
- 关于js 动态绑定事件的一个问题
- 动态换皮肤问题
- 如何从既有文本又有图片的HTMLEditor内容Content中,将图片名称和地址分离出来?
- 寻求对function 的理解
- 高分求解:多窗口浏览器,点击广告显示真实地址问题。
- 急问
- 我用makecert.exe和SignCode.Exe数字签名ActiveX控件出现的错误
- 请教,关于自建对象的问题
- 怎樣動態改變<xsl:if test=".[@area_id=1]">的條件
- 如何获取在frame中的元素。
- ajax调用在jquery-1.4.2.js不能运行,而jquery-1.3.2.min.js则可以
- extjs4 所有窗口看不到关闭按钮,但可以点击
其他的现在这台机没调试环境,等其他高手解决吧
var id='mes'+i;
var newdiv=document.createElement(name);
这句话什么意思document.createElement('messagediv1');
??
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>111</title>
<script type="text/javascript">
var i=1;
var divzhanchun;
var step;
function creatediv()
{
var tagN ="div";
var name='messagediv'+i;
var id='mes'+i;
var newdiv=document.createElement(tagN);
newdiv.name=name;
newdiv.id=id;
newdiv.innerHTML='你是不是想吃屎啊';
newdiv.style.top='300px';
newdiv.style.left='20px';
newdiv.style.position='absolute';
divzhanchun=newdiv;
newdiv.onclick=control;document.body.appendChild(newdiv);
}function mandalpha()
{var left = document.getElementById('mes'+i).style.left.match(/\d+/)[0];
left = parseInt(left);
left = left>window.screen.width ? 20 : left+5;
document.getElementById('mes'+i).style.left = left + "px" ;}function control()
{
setInterval('mandalpha()',20);
}
</script></head>
<body onload="creatediv()"><script></script>
</body>
</html>
我的其他的代码:<%@ Page Language="C#" AutoEventWireup="true" CodeFile="mianchat2.aspx.cs" Inherits="mianchat2" %><!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" language="javascript">
var i=1;
var divzhanchun;
var step;
function creatediv()
{
var tagN ="div";
var name='messagediv'+i;
var id='mes'+i;
var newdiv=document.createElement(tagN);
newdiv.id=id;
newdiv.name=name;
newdiv.innerHTML='你是不是想吃屎啊';
newdiv.style.top='300px';
newdiv.style.left='220px';
newdiv.style.width='200px';
newdiv.position='absolute';
newdiv.style.border="1px solid #000000";
divzhanchun=newdiv;
// newdiv.onclick= control;
newdiv.setAttribute("onload",control());
document.body.appendChild(newdiv);
i++;
}function mandalpha()
{
//// var time1;
//// step=(500-parseInt(divzhanchun.style.left))/10;
// step=parseInt(divzhanchun.style.left)+5;
// divzhanchun.style.left=step+'px';
var left =document.getElementById('mes1').style.left.match(/\d+/)[0];
left = parseInt(left);
left = left>window.screen.width ? 20 : left+5;
// alert(left);
document.getElementById('mes1').style.left = left + "px" ;
}function control()
{
setInterval('mandalpha()',20);
}</script>
<style type="text/css">
#contener {
height: 1200px;
width: 990px;
}
#contener #top {
height: 170px;
width: 990px;
background-color: #F9C;
}
#contener #middle_left {
float: left;
height: 600px;
width: 620px;
background-color: #0FF;
overflow:scroll;
}
#contener #middle_right {
float: left;
height: 750px;
width: 370px;
background-color:#9F0;
overflow:scroll;
}
#contener #middle_left_contener #middle_left_buttom #txtmessage {
height: 90px;
width: 480px;
float:left;
border:5;
}
#contener #middle_left_contener{
float:left;
height:750px;
width:620px;
background-color:#999;
}
#contener #middle_left_contener #middle_left_buttom {
float:left;
background-color: #FF0;
height: 150px;
width: 620px;
}
#contener #contener_buttom {
background-color: #0FF;
float: left;
height: 250px;
width: 990px;
}
</style>
</head><body><center>
<div id="contener" >
<div id="top" align="left">此处显示的事也头文件</div>
<div id="middle_left_contener">
<div id="middle_left"> sdssd</div>
<div id="middle_left_buttom" align="left">
<div id="middle_left_contener_buttom_top" style="height:40px;"></div>
<input id="txtmessage" type="text"/>
<img src="img/send.png" style="height: 85px; width: 68px" onmousedown
="javascript:localtion:src='img/send2.png'" onmouseup="javascript:localtion:src='img/send.png'" onclick="creatediv()"/>
</div></div>
<div id="middle_right">iddleleft</div>
<div id="contener_buttom">
</div>
</div>
</div></center>
</body>
</html>
</html>
我的其他的代码:<%@ Page Language="C#" AutoEventWireup="true" CodeFile="mianchat2.aspx.cs" Inherits="mianchat2" %><!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" language="javascript">
var i=1;
var divzhanchun;
var step;
function creatediv()
{
var tagN ="div";
var name='messagediv'+i;
var id='mes'+i;
var newdiv=document.createElement(tagN);
newdiv.id=id;
newdiv.name=name;
newdiv.innerHTML='你是不是想吃屎啊';
newdiv.style.top='300px';
newdiv.style.left='220px';
newdiv.style.width='200px';
newdiv.position='absolute';
newdiv.style.border="1px solid #000000";
divzhanchun=newdiv;
// newdiv.onclick= control;
newdiv.setAttribute("onload",control());
document.body.appendChild(newdiv);
i++;
}function mandalpha()
{
//// var time1;
//// step=(500-parseInt(divzhanchun.style.left))/10;
// step=parseInt(divzhanchun.style.left)+5;
// divzhanchun.style.left=step+'px';
var left =document.getElementById('mes1').style.left.match(/\d+/)[0];
left = parseInt(left);
left = left>window.screen.width ? 20 : left+5;
// alert(left);
document.getElementById('mes1').style.left = left + "px" ;
}function control()
{
setInterval('mandalpha()',20);
}</script>
<style type="text/css">
#contener {
height: 1200px;
width: 990px;
}
#contener #top {
height: 170px;
width: 990px;
background-color: #F9C;
}
#contener #middle_left {
float: left;
height: 600px;
width: 620px;
background-color: #0FF;
overflow:scroll;
}
#contener #middle_right {
float: left;
height: 750px;
width: 370px;
background-color:#9F0;
overflow:scroll;
}
#contener #middle_left_contener #middle_left_buttom #txtmessage {
height: 90px;
width: 480px;
float:left;
border:5;
}
#contener #middle_left_contener{
float:left;
height:750px;
width:620px;
background-color:#999;
}
#contener #middle_left_contener #middle_left_buttom {
float:left;
background-color: #FF0;
height: 150px;
width: 620px;
}
#contener #contener_buttom {
background-color: #0FF;
float: left;
height: 250px;
width: 990px;
}
</style>
</head><body><center>
<div id="contener" >
<div id="top" align="left">此处显示的事也头文件</div>
<div id="middle_left_contener">
<div id="middle_left"> sdssd</div>
<div id="middle_left_buttom" align="left">
<div id="middle_left_contener_buttom_top" style="height:40px;"></div>
<input id="txtmessage" type="text"/>
<img src="img/send.png" style="height: 85px; width: 68px" onmousedown
="javascript:localtion:src='img/send2.png'" onmouseup="javascript:localtion:src='img/send.png'" onclick="creatediv()"/>
</div></div>
<div id="middle_right">iddleleft</div>
<div id="contener_buttom">
</div>
</div>
</div></center>
</body>
</html>
</html>