87,917
社区成员
发帖
与我相关
我的任务
分享
<html xmlns:t="urn:schemas-microsoft-com:time">
<head>
<?import namespace="t" implementation="#default#time2">
<style>.t {behavior: url(#default#time2)}</style>
</head>
<body>
<!--模板划分区域划-->
<div name ="region" style="position: absolute; top: 100; left: 100; width: 800; height: 400; background-color:#F0FACC"/>
<!--区域1-->
<div name ="region1" style="position: absolute; top: 68; left: 70; width: 300; height: 240; z-index:2; background-color:#AE00AE; font-size:2px">
</div>
<!--区域2-->
<div name ="region2" style="position: absolute; top: 68; left: 430; width: 300; height: 240; z-index:2; background-color:#019858; font-size:2px">
</div>
</div>
</body>
</html>
<div id="region1" name="region1" style=" position:absolute">
<input id="Text1" type="text" />
<input id="Button1" type="button" value="button" onclick="javascript:ChangeDivTop()" />
</div>
function ChangeDivTop() {
var elements = document.getElementsByName("region1");
for (var i = 0; i < elements.length; i++) {
elements[i].style.top = document.getElementById('Text1').value + "px";
}
}
<script>
function cal(){
var region1 = document.getElementsByName("region1")[0],
value = document.getElementById('val').value;
if (region1 && value) region1.style.top = value + 'px';
}
</script>
<body>
<input id="val" type="text" value="100"><input type="button" value="Set region1 Top" onclick="cal()">
<html xmlns:t="urn:schemas-microsoft-com:time">
<head>
<?import namespace="t" implementation="#default#time2">
<style>.t {behavior: url(#default#time2)}</style>
</head>
<script>
function cal(){
var a = document.getElementsByTagName("div");
var obj = null;
for(var i=0;i<a.length;i++){
if(a[i].name=="region1"){
obj = a[i];
obj.style.top = document.getElementById('val').value
break;
}
}
}
</script>
<body>
<input id="val" type="text" value="100"> <input type="button" value="Set Top" onclick="cal()">
<!--模板划分区域划-->
<div name ="region" style="position: absolute; top: 100; left: 100; width: 800; height: 400; background-color:#F0FACC"/>
<!--区域1-->
<div name ="region1" style="position: absolute; top: 68; left: 70; width: 300; height: 240; z-index:2; background-
color:#AE00AE; font-size:2px">
</div>
<!--区域2-->
<div name ="region2" style="position: absolute; top: 68; left: 430; width: 300; height: 240; z-index:2; background-
color:#019858; font-size:2px">
</div>
</div>
</body>
</html>
<html xmlns:t="urn:schemas-microsoft-com:time">
<head>
<?import namespace="t" implementation="#default#time2">
<style>.t {behavior: url(#default#time2)}</style>
</head>
<script>
function cal(){
var a = document.getElementsByTagName("div");
var obj = null;
for(var i=0;i<a.length;i++){
if(a[i].name=="region1"){obj = a[i];break;}
}
if(bhj!=null) obj.style.top = document.getElementById('val').value
}
</script>
<body>
<input id="val" type="text" value="100"> <input type="button" value="xxxx" onclick="cal()">
<!--模板划分区域划-->
<div name ="region" style="position: absolute; top: 100; left: 100; width: 800; height: 400; background-color:#F0FACC"/>
<!--区域1-->
<div name ="region1" style="position: absolute; top: 68; left: 70; width: 300; height: 240; z-index:2; background-color:#AE00AE; font-size:2px">
</div>
<!--区域2-->
<div name ="region2" style="position: absolute; top: 68; left: 430; width: 300; height: 240; z-index:2; background-color:#019858; font-size:2px">
</div>
</div>
</body>
</html>
<input id="txt" type="text" value="">
<input type="button" value="ok" onclick="cal()">
<script>
function cal(){
region1.style.top=txt.value
}
</script>