Логин:

Пароль:

Форумы
Общие вопросы
Document Object Model
Обсуждаем конференцию
Web Usability (test)

Общие вопросы

Как в ДХТМЛе нормально позиционировать?

> Есть таблица основная в ней сайт , она центрирована, и надо чтобы текст на ДХТМле был относительно этой таблицы. Если взять текст (он в таблице) и вставить его то он занимает на сайте место кроме случаю absoluite

Сам искал такое наверное неделю.

Еще не разбирался как оно работает, но работает и в IE и в NN.
Буду благодарен за вменяемые обьяснения позиционирования слоя в ячейке таблицы.

С уважением Sv.

<STYLE type=text/css></STYLE>

<SCRIPT language=JavaScript type=text/javascript>
/********************************************************************************
Copyright (C) 1999 Thomas Brattli
This script is made by and copyrighted to Thomas Brattli at www.bratta.com
Visit for more great scripts. This may be used freely as long as this msg is intact!
I will also appriciate any links you could give me.
********************************************************************************/
file://Default browsercheck, added to all scripts!
function checkBrowser(){
this.ver=navigator.appVersion
this.dom=document.getElementById?1:0
this.ie5=(this.ver.indexOf("MSIE 5")>-1 && this.dom)?1:0;
this.ie4=(document.all && !this.dom)?1:0;
this.ns5=(this.dom && parseInt(this.ver) >= 5) ?1:0;
this.ns4=(document.layers && !this.dom)?1:0;
this.bw=(this.ie5 || this.ie4 || this.ns4 || this.ns5)
return this
}
bw=new checkBrowser()
/********************************************************************************
Here's the pageobject, see www.bratta.com/dhtml for tutorial on how it works.
********************************************************************************/
function makePageObject(){
this.x=0;
this.x2=(bw.ns4 || bw.ns5)?innerWidth:document.body.offsetWidth-20;
this.y=0;
this.y2=(bw.ns4 || bw.ns5)?innerHeight:document.body.offsetHeight-4;
this.x50=this.x2/2;
this.y50=this.y2/2;
this.x10=(this.x2*10)/100
this.y10=(this.y2*10)/100
this.x15=(this.x2*15)/100
this.y15=(this.y2*15)/100
return this;
}
/********************************************************************************
Making the objects, Cross-browser and makes a moveIt function that will move the
object easely
********************************************************************************/
function makeObj(obj,nest){
nest=(!nest) ? '':'document.'+nest+'.'
this.css=bw.dom? document.getElementById(obj).style:bw.ie4?document.all[obj].style:bw.ns4?eval(nest+"document.layers." +obj):0;
this.moveIt=b_moveIt;
return this
}
function b_moveIt(x,y){
this.css.left=x
this.css.top=y
}
/********************************************************************************
Here we call the object constructor to make objects, then we move
them to a choosen place on the page.
********************************************************************************/
function pageInit(){
file://first me make a page object
page=new makePageObject()
file://then we make the layer objects
oCenter=new makeObj('divCenter')
oRightTop=new makeObj('divRightTop')
oRightBottom=new makeObj('divRightBottom')
oLeftTop=new makeObj('divLeftTop')
oLeftBottom=new makeObj('divLeftBottom')
file://now we place them
file://The divs has a width and height of 100, so we divide that with 2 to place it at center
oCenter.moveIt(page.x50-50,page.y50-50)
oRightTop.moveIt(page.x2-100,page.y)
oRightBottom.moveIt(page.x2-100,page.y2-100)
oLeftTop.moveIt(page.x,page.y)
oLeftBottom.moveIt(page.x,page.y2-100)
file://Takes care of the resizing.
window.onresize=resized;
}
function resized(){
page2=new makePageObject()
if(page2.x2!=page.x2 || page2.y2!=page.y2){
location.reload() file://If the width or height have changed we reload the page.
}
}

file://Calls the init function on pageload;
onload=pageInit;
</SCRIPT>

<DIV id=divCenter
style="BACKGROUND-COLOR: #cccccc; CLIP: rect(0px 100px 100px 0px); FONT-FAMILY: arial; FONT-SIZE: 10pt; HEIGHT: 100px; PADDING-BOTTOM: 5pt; PADDING-LEFT: 5pt; PADDING-RIGHT: 5pt; PADDING-TOP: 5pt; POSITION: absolute; WIDTH: 100px; layer-background-color: #CCCCCC">This
is on the center and middle of the page</DIV>
<DIV id=divRightTop
style="BACKGROUND-COLOR: #cccccc; CLIP: rect(0px 100px 100px 0px); FONT-FAMILY: arial; FONT-SIZE: 10pt; HEIGHT: 100px; PADDING-BOTTOM: 5pt; PADDING-LEFT: 5pt; PADDING-RIGHT: 5pt; PADDING-TOP: 5pt; POSITION: absolute; WIDTH: 100px; layer-background-color: #CCCCCC">This
is on the top-right</DIV>
<DIV id=divRightBottom
style="BACKGROUND-COLOR: #cccccc; CLIP: rect(0px 100px 100px 0px); FONT-FAMILY: arial; FONT-SIZE: 10pt; HEIGHT: 100px; PADDING-BOTTOM: 5pt; PADDING-LEFT: 5pt; PADDING-RIGHT: 5pt; PADDING-TOP: 5pt; POSITION: absolute; WIDTH: 100px; layer-background-color: #CCCCCC">This
is on the bottom-right</DIV>
<DIV id=divLeftTop
style="BACKGROUND-COLOR: #cccccc; CLIP: rect(0px 100px 100px 0px); FONT-FAMILY: arial; FONT-SIZE: 10pt; HEIGHT: 100px; PADDING-BOTTOM: 5pt; PADDING-LEFT: 5pt; PADDING-RIGHT: 5pt; PADDING-TOP: 5pt; POSITION: absolute; WIDTH: 100px; layer-background-color: #CCCCCC">This
is on the top-left</DIV>
<DIV id=divLeftBottom
style="BACKGROUND-COLOR: #cccccc; CLIP: rect(0px 100px 100px 0px); FONT-FAMILY: arial; FONT-SIZE: 10pt; HEIGHT: 100px; PADDING-BOTTOM: 5pt; PADDING-LEFT: 5pt; PADDING-RIGHT: 5pt; PADDING-TOP: 5pt; POSITION: absolute; WIDTH: 100px; layer-background-color: #CCCCCC">This
is on the bottom-left</DIV>YOUR REGULAR BODY CONTENT GOES IN HERE
СообщениеАвторДата
Denis14.07.2001 22:04
Leechy16.07.2001 13:29
Sv-art15.07.2001 23:25