这里改一下: window.alert( thisObject.innerText);
解决方案 »
- 一段js的实现
- 急!怎样得到公交路线的所有途径站点?
- Jquery 选项卡 刷新
- javascript控制displayIE下正常,火狐不行,什么原因, IE下调试一切正常,Opera下调试可以起作用,但会打乱布局,而火狐下根本就不起作
- JavaScript 让我学得好迷茫。
- 如何关闭窗口?
- 急啊,高手请教:如何在body onload事件中设定窗口的属性
- 请问树形菜单的基本原来是什么?哪位能贴出一段实现基本功能的树形菜单代码?
- 在javascript获得当前年的函数是什么
- javascript创建的object需不需要释放,怎么释放?
- JAVASCRIPT中如何判断字符串为数字字符串,以及字符串长度的判断。
- 如何实现点击发声的效果???解决立刻给分!
少了ID
你是通过ID拿对象的,所以必须要有ID
style="position: absolute; left: 241; top: 15; width: 150; lineheight: 8px; ">This is my object with.</div>
<script language="JavaScript">
function moreSpace(objectID)
{
var thisObject = document.getElementById( objectID );
thisObject.style.lineHeight = "3";
}
</script><div id="myObject" name="myObject" style="position: absolute; left: 241; top: 15; width: 150; lineheight:20px;">This is my object with.This is my object with.This is my object with.</div>
<a href="#" onClick=moreSpace("myObject") >Increase the line spacing.</a>
不过初始的那个style中的设置还是没有起作用,不知道为什么。
点击事件中的是可以了
-----------------------------------------------------------------------------------<html><head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<meta name="GENERATOR" content="Microsoft FrontPage 4.0">
<meta name="ProgId" content="FrontPage.Editor.Document">
<title>New Page 1</title>
<script language="JavaScript">
function moreSpace(objectID)
{
var thisObject = document.getElementById( objectID );
window.alert( thisObject.innerText);
thisObject.style.lineHeight = parseInt(thisObject.style.lineHeight ) + 10 + "px";
window.alert( thisObject.style.lineHeight );
}
</script>
</head><body>
<div name="myObject" id="myObject" onmouseover="this.style.lineHeight='200px'"
style="position: absolute; left: 241; top: 15; width: 150; font-size: 14px; lineheight: 10px; background-color: #cccccc; height: 52">
This is my object with.
</div>
<br>
<a href="JavaScript:moreSpace('myObject');">moreSpace</a>
<a href="#" onClick=moreSpace("myObject") >moreSpace</a> </body></html>
-------------------------------------------
<script language="JavaScript">
function moreSpace(objectID)
{
var thisObject = document.getElementById( objectID );
alert( thisObject.innerText);
thisObject.style.lineHeight = 250 + "px";
}
</script> <div id="myObject" style="position: absolute; left: 241; top: 15; width: 150; lineheight: 8px; ">This is my object with.</div>
<a href="#" onClick=moreSpace("myObject") >Increase the line spacing.</a>
-------------------------------------------
<script language="JavaScript">
function moreSpace(objectID)
{
var thisObject = document.getElementById( objectID );
alert( thisObject.innerText);
thisObject.style.lineHeight = 250 + "px";
}
</script> <div id="myObject" style="position: absolute; left: 241; top: 15; width: 150; lineheight: 8px; ">This is my object with.</div>
<a href="#" onClick=moreSpace("myObject") >Increase the line spacing.</a>
lineheight: 8px
=>
line-height:8px
其它没问题
-- 你的代码和我的没有什么分别啊?ice_berg16(寻梦的稻草人)
-- 即便我改写成 line-height:8px 但是第一次仍然无法改变 line-height; 只有第二次才成功
-- 你的代码和我的没有什么分别啊?ice_berg16(寻梦的稻草人)
-- 即便我改写成 line-height:8px 但是第一次仍然无法改变 line-height; 只有第二次才成功
function moreSpace(objectID)
{
var thisObject = document.getElementById( objectID );
//alert(thisObject);
thisObject.style.lineHeight= 40 + "px";
}
</script> <div id="myObject" style="position:absolute;left:241px;top:15px;width:150px;line-height:10px;">This is my object with.</div>
<a href="#" onClick='moreSpace("myObject")' >Increase the line spacing.</a>
-- 你的代码和我的没有什么分别啊?
---------------------------------------你確定你是一個一個字母對了麽!!!!