Jump to content

Kevin McLean

Members
  • Posts

    12
  • Joined

  • Last visited

    Never

Posts posted by Kevin McLean

  1. Change to

    <script language="JavaScript"  type="text/javascript">
    function getElementsByClass(searchClass,node,tag) {
    var classElements = new Array();
    if ( node == null )
    	node = document;
    if ( tag == null )
    	tag = '*';
    var els = node.getElementsByTagName(tag);
    var elsLen = els.length;
    
    var pattern = new RegExp("(^|\\s)"+searchClass+"(\\s|$)");
    for (i = 0, j = 0; i < elsLen; i++) {
    	if ( pattern.test(els[i].className) ) {
    		classElements[j] = els[i];
    		j++;
    	}
    }
    return classElements;
    }
    
    
    
    
    
    function show_bar(ev,nom) {
    MouseX = ev.clientX + document.body.scrollLeft;
    MouseY = ev.clientY + document.body.scrollTop;
    obj = document.getElementsByClass[0](nom);
    obj.style.top = MouseY + 10-document.getElementsByClass[0]("wrap").offsetParent.offsetTop-40+"px";
    obj.style.left = MouseX-document.getElementsByClass[0]("wrap").offsetParent.offsetLeft+"px";
    obj.style.visibility = "visible";
    
    }function hide_bar(nom) {document.getElementsByClass[0](nom).style.visibility="hidden"}</script>

    but still nothing happens

  2. Hi everybody. I'm a newbie in web designing so that faced a lot of problems concerning combination of css and js in developing my web page.

    First of all, in my css file I use classes and it does not allow me to embody my idea: I want a block with info to appear after clicking on a nick name.

    Javascript file which is in charge of block behaviour.

    <script language="JavaScript"  type="text/javascript">
    function getElementsByClass(searchClass,node,tag) {
    var classElements = new Array();
    if ( node == null )
    	node = document;
    if ( tag == null )
    	tag = '*';
    var els = node.getElementsByTagName(tag);
    var elsLen = els.length;
    
    var pattern = new RegExp("(^|\\s)"+searchClass+"(\\s|$)");
    for (i = 0, j = 0; i < elsLen; i++) {
    	if ( pattern.test(els[i].className) ) {
    		classElements[j] = els[i];
    		j++;
    	}
    }
    return classElements;
    }
    
    
    
    
    
    function show_bar(ev,nom) {
    MouseX = ev.clientX + document.body.scrollLeft;
    MouseY = ev.clientY + document.body.scrollTop;
    obj = document.getElementById(nom);
    obj.style.top = MouseY + 10-document.getElementByClass("wrap").offsetParent.offsetTop-40+"px";
    obj.style.left = MouseX-document.getElementByClass("wrap").offsetParent.offsetLeft+"px";
    obj.style.visibility = "visible";
    
    }function hide_bar(nom) {document.getElementByClass(nom).style.visibility="hidden"}</script>

     

    webpage:

    http://gviragon.ru/study/students.php

    so when I click on a nickname in one of 3 tables nothing happens.

     

    The second problem, there is a gigant space after layout caused by this js, is it  possible to avoid it?

    Could somebody help me with that?

    Thank you

  3. I've got a script which displays files in directory. But I strongly need it to display files only with names like

    number.php

    so it would display files which contain only digits in its name and .php. I know that it could be achieved using regex, but my knowledge about them is practically zero, could somebody, please help me to modify the script.

    <?
    
    $path = '/.../archive/';
    $file = scandir($path);
    unset($file[0], $file[1]);  
    function _sortCTime($file1, $file2){
        $time1 = filectime('archive/' . $file1); 
        $time2 = filectime('archive/' . $file2); 
        if($time1 == $time2)
          return 0;
        return ($time1 < $time2) ? -1 : 1;
      }  
    
    
    $i=1;
    $f = 'семестр';
    usort($file, "_sortCTime");
    foreach($file as $item){
        
                $i++;
                echo "$i $f. <a href='archive/$item'>Успеваемость</a><br />"; 
    
        }  
    
    ?>

  4. I was trying to write a simple script which would change the the layout according day time, but it does not work. Please, could somebody help me to fix the problem?

     

    PHP Code:

    <? 
    $hour = date(”H”); 
    if ($hour > 9 || $hour < 18) 
    { 
    include('eldia/day_header.php'); 
    } 
    elseif ($hour > 18 || $hour < 9) 
    { 
    include('lanoche/night_header.php'); 
    } 
    else  
    { 
    echo "Заклинания не работают!"; 
    } 
    include('main.php'); 
    <? 
    $hour = date(”H”); 
    if ($hour > 9 || $hour < 18) 
    { 
    include('eldia/day_footer.php'); 
    } 
    elseif ($hour > 18 || $hour < 9) 
    { 
    include('lanoche/night_footer.php'); 
    } 
    else  
    { 
    echo "Заклинания не работают!"; 
    } 
    ?> 

    There are only 2 layouts - one for day and one for night.

    And one more question how to count time according not the server time, but accroding a users' time?

     

    Thank you

  5. Could somebody explain me why td#13 in my layout doesn't stretch for 100% height of browser window?

    http://gviragon.ru/example/index.html

     

    pr3.jpg

     

     

     

    css for td#13

     

     

    td#13 {background-image: url(images/index_13.jpg); background-repeat: repeat; width: 100%; height: 100%;}

    the whole css:

     

    /* author: AFFLiCTiON */
    /* Creation date: 10.01.2009 */
    body {background: #000000 url(images/bg.jpg) repeat-x; margin: 0;}
    table#main {border: 0; width: 100%; height: 100%;}
    td#1 {background-image: url(images/index_01.jpg); background-repeat: no-repeat; width: 189px; height: 257px;}
    td#2 {background-image: url(images/index_02.jpg); background-repeat: no-repeat; height:187px;}
    td#3 {background-image: url(images/index_03.jpg); background-repeat: no-repeat; width: 189px; height:187px; }
    td#4 {background-image: url(images/index_04.jpg); background-repeat: repeat-x; height:187px;}
    td#5 {background-image: url(images/index_05.jpg); background-repeat: no-repeat; width: 178px; height: 257px;}
    td#6 {background-image: url(images/index_06.jpg); background-repeat: repeat-x; height: 51px;}
    td#7 {background-image: url(images/index_07.jpg); background-repeat: no-repeat; width: 31px; height: 38px;}
    td#8 {background-image: url(images/index_08.gif); background-repeat: repeat-x;  height: 38px;}
    td#9 {background-image: url(images/index_09.jpg); background-repeat: no-repeat; width: 34px; height: 38px;}
    td#10 {background-image: url(images/index_10.jpg); background-repeat: repeat-y; width: 189px;}
    td#11 {background-image: url(images/index_11.jpg); background-repeat: repeat-y; width: 178px;}
    td#12 {background-image: url(images/index_12.jpg); background-repeat: repeat-y; width: 31px; height: 100%;}
    td#13 {background-image: url(images/index_13.jpg); background-repeat: repeat; width: 100%; height: 100%;}
    td#14 {background-image: url(images/index_14.jpg); background-repeat: repeat-y; width: 34px; height: 100%;}
    td#15 {background-image: url(images/index_15.jpg); background-repeat: no-repeat; width: 189px;}
    td#16 {background-image: url(images/index_16.jpg); background-repeat: no-repeat; width: 178px;}
    td#17 {background-image: url(images/index_17.jpg); width: 31px; height: 32px;}
    td#18 {background-image: url(images/index_18.gif); background-repeat: repeat-x; height: 32px;}
    td#19 {background-image: url(images/index_19.jpg); width: 34px; height: 32px;}
    td#20 {background-image: url(images/index_20.jpg); height: 45px;}

     

     

    HTML Code:

    <html>
    <head>
    <title>Гвирагон</title>
    <meta http-equiv="Content-Type" content="text/html; charset=windows-1251">
    <link rel="stylesheet" href="night.css">
    </head>
    <body>
    <table id="main" cellpadding="0" cellspacing="0" align="center">
    <tr>
    	<td id="1" rowspan="3">
    		</td>
    	<td id="2" colspan="2">
    		</td>
    	<td id="3">
    		</td>
    	<td id="4" colspan="2">
    		</td>
    	<td id="5" rowspan="3">
    		</td>
    	<td>
    		<img src="images/spacer.gif" width="1" height="187" alt=""></td>
    </tr>
    <tr>
    	<td id="6" colspan="5">
    		</td>
    	<td>
    		<img src="images/spacer.gif" width="1" height="51" alt=""></td>
    </tr>
    <tr>
    	<td id="7" rowspan="2">
    		</td>
    	<td id="8" colspan="3" rowspan="2">
    		</td>
    	<td id="9" rowspan="2">
    		</td>
    	<td>
    		<img src="images/spacer.gif" width="1" height="19" alt=""></td>
    </tr>
    <tr height="100%">
    	<td id="10" rowspan="2">
    		</td>
    	<td id="11" rowspan="2">
    		</td>
    	<td>
    		<img src="images/spacer.gif" width="1" height="19" alt=""></td>
    </tr>
    <tr height="100%">
    	<td id="12" rowspan="2">
    		</td>
    	<td id="13" colspan="3" rowspan="2" valign="top">sdfkhsdkghkagfk
    		</td>
    	<td id="14" rowspan="2">
    		</td>
    	<td>
    		<img src="images/spacer.gif" width="1" height="53" alt=""></td>
    </tr>
    <tr>
    	<td id="15" rowspan="3">
    		</td>
    	<td id="16" rowspan="3">
    		</td>
    	<td>
    		<img src="images/spacer.gif" width="1" height="23" alt=""></td>
    </tr>
    <tr>
    	<td id="17">
    		</td>
    	<td id="18" colspan="3">
    		</td>
    	<td id="19">
    		</td>
    	<td>
    		<img src="images/spacer.gif" width="1" height="32" alt=""></td>
    </tr>
    <tr>
    	<td id="20" colspan="5">
    		</td>
    	<td>
    		<img src="images/spacer.gif" width="1" height="45" alt=""></td>
    </tr>
    <tr>
    	<td>
    		<img src="images/spacer.gif" width="189" height="1" alt=""></td>
    	<td>
    		<img src="images/spacer.gif" width="31" height="1" alt=""></td>
    	<td>
    		<img src="images/spacer.gif" width="144" height="1" alt=""></td>
    	<td>
    		<img src="images/spacer.gif" width="189" height="1" alt=""></td>
    	<td>
    		<img src="images/spacer.gif" width="135" height="1" alt=""></td>
    	<td>
    		<img src="images/spacer.gif" width="34" height="1" alt=""></td>
    	<td>
    		<img src="images/spacer.gif" width="178" height="1" alt=""></td>
    	<td></td>
    </tr>
    </table>
    </body>
    </html>

  6. Since you're using a lot of table cells, I would think it was just a misprint from the cell widths stated in the source, and the real size of the images. Firefox only has about a 5 pixel gap and Opera looks fine! I guess you're already on the right track!

    I've fixed it. The problem was with the cells where I used width of 50%

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.