-2

Вроде все правильно написано.

<!DOCTYPE HTML>
<html>

<head>
    <link href=poke-x_inventar.css rel=Stylesheet type=text/css>
    <script src='http://ajax.googleapis.com/ajax/libs/jquery/1.5/jquery.min.js'>

    </script>
    <script src='http://poke-x.ru/js/game.js'></script>
    <script>
        // JavaScript Document
        function position(event) {
            var x = y = 0;
            if (document.attachEvent != null) {
                x = event.clientX + (document.documentElement.scrollLeft ? document.documentElement.scrollLeft : document.body.scrollLeft);
                y = event.clientY + (document.documentElement.scrollTop ? document.documentElement.scrollTop : document.body.scrollTop);
            } else if (!document.attachEvent && document.addEventListener) {
                x = event.clientX + scrollX;
                y = event.clientY + scrollY;
            } else {}
            return {
                x: x,
                y: y
            };
        }

        function items(name, item_id, count, description) {
            html = "<img src='images/items/item/" + item_id + ".png' border='0'><br>";
            html = html + "<b>" + name + " x" + count + ".</b><p>" + description + ".</p>";
            document.items_t.innerHTML = html;
            document.items.style.left = position(event).x;
            document.items.style.top = position(event).y;
            document.items.style.display = "block";
        }
    </script>
</head>

<body>
    <div ID="items">
        <div id="items_t"></div>
    </div>
    <div id=inv>
        <div id=inv_t>
            <img src="item.gif" width=9 height=10 onclick="items('Pokeball','1','1','O_o')"
            style="CURSOR:POINTER">
        </div>
    </div>
</body>

</html>

и css файл:

* {
    margin: 0px;
    padding: 0px;
}
html {
    height: 100%;
}
body {
    background-attachment: fixed;
    background-image: url("images/bg.jpg");
    background-position: top left;
    background-repeat: repeat;
    height: 100%;
    margin: 0px auto;
    padding: 0px;
    width: 100%;
}
.bg-glad {
    background-attachment: fixed;
    background-image: url("images/page_gl.png");
    background-position: top left;
    background-repeat: no-repeat;
    bottom: 0px;
    left: 0px;
    position: relative;
    right: 0px;
    top: 0px;
}
#wrapper (основной контейнер в котором находится все за исключение футера) {
    background-color: #c9f8f8;
    border-radius: 30px;
    height: auto !important;
    margin: 0px auto;
    min-height: 100%;
    width: 992px;
}
/* Header;
-----------------------------------------------------------------------------*/
#header {
    height: 175px;
}
.header-img {
    background-image: url("images/header.jpg");
    background-position: center center;
    background-repeat: no-repeat;
    border-radius: 20px 20px 0px 0px;
    height: 175px;
    position: absolute;
    top: 0px;
    width: 992px;
}
#zag {
    color: #f6fe1c;
    font-family: Palatino Linotype, Geneva, Helvetica, sans-serif;
    font-size: 20px;
    margin: 60px 0px 0px 15px;
    position: absolute;
}
#zag a {
    color: #f6fe1c;
    font-family: Palatino Linotype, Geneva, Helvetica, sans-serif;
    font-size: 30px;
    text-decoration: none;
}
#zag a:hover {
    color: #fcffbd;
    text-decoration: underline;
}
/* begin Flash */
#art-flash-area {
    border-radius: 20px;
    height: 175px;
    left: 0px;
    overflow: hidden;
    position: absolute;
    top: 0px;
    width: 992px;
}
#art-flash-container {
    height: 248px;
    left: 0px;
    position: absolute;
    top: -36px;
    width: 992px;
}
#art-flash-container div.art-flash-alt {
    height: 30px;
    margin: 0px auto;
    position: relative;
    top: 36px;
    width: 110px;
}
/* Header END;
-----------------------------------------------------------------------------*/
/* Middle;
#middle (контейнер идущий сразу за хедером внутри wraper после хедера занимает все оставшееся пространство) {
    height: 1%;
    padding: 0 0 100px;
    position: relative;
    width: 100%;
}
;
#middle:after {
    clear: both;
    content: '.';
    display: block;
    height: 0;
    visibility: hidden;
}
;
#container (находится в нутри middle соседствует с left sidbar) {
    float: right;
    width: 100%;
    z-index: 3;
}
;
#content (контейнер внутри container содержащий контент) {
    background-color: #b1f6b9;
    display: block;
    margin: 5px 5px -5px 225px;
    overflow: auto;
    position: relative;
    top: 40px;
}
;
/* menu (синее меню под хедером);
-----------------------------------------------------------------------------*/
.menu {
    background: url("images/nav.png") repeat-x;
    display: block;
    overflow: hidden;
    position: absolute;
    width: 992px;
    z-index: 5;
}
.menu ul {
    display: block;
    list-style: none;
}
.menu ul li {
    display: block;
    float: left;
    margin: 0px 10px;
    padding: 10px 15px;
}
.menu ul li a {
    color: #fff;
    font: 16px "Palatino Linotype" Verdana, sans-serif;
    text-decoration: none;
}
.menu ul li:hover {
    background: url("images/nav_hover.png") repeat-x;
    display: block;
}
.menu ul li a:hover {
    color: #fff;
    display: block;
    font: 16px "Palatino Linotype" Verdana, sans-serif;
    text-decoration: underline;
    z-index: 5;
}
/* Vipadayuchie menu;
-----------------------------------------------------------------------------*/
#biz_menu {
    background: #0204a2;
    display: none;
    float: left;
    margin-left: 105px;
    position: absolute;
    top: 35px;
    z-index: 3;
}
#biz_menu div {
    display: block;
    padding: 2px 20px 2px 10px;
}
#biz_menu div:hover {
    background: #3983f9;
}
#biz_menu a {
    color: #fff;
    font: 16px "Palatino Linotype";
    text-decoration: none;
}
#biz_menu a:hover {
    color: #fff;
    font: 16px "Palatino Linotype";
    text-decoration: underline;
}
#plati_menu {
    background: #0204a2;
    display: none;
    float: left;
    margin-left: 310px;
    position: absolute;
    top: 35px;
    z-index: 3;
}
#plati_menu div {
    display: block;
    padding: 2px 30px 2px 10px;
}
#plati_menu div:hover {
    background: #3983f9;
}
#plati_menu a {
    color: #fff;
    font: 16px "Palatino Linotype";
    text-decoration: none;
}
#plati_menu a:hover {
    color: #fff;
    font: 16px "Palatino Linotype";
    text-decoration: underline;
}
#bg {
    background-image: url("images/vmenu1.png");
    background-position: right;
    background-repeat: no-repeat;
}
#bg:hover {
    background-image: url("images/vmenu.png");
    background-position: right;
    background-repeat: no-repeat;
}
#privat_menu {
    background: #0204a2;
    display: none;
    float: left;
    margin-left: 450px;
    position: absolute;
    top: 35px;
    z-index: 3;
}
#privat_menu span div {
    display: block;
    padding: 2px 20px 2px 10px;
}
#privat_menu span div:hover {
    background: #3983f9;
}
#privat_menu a {
    color: #fff;
    font: 16px "Palatino Linotype";
    text-decoration: none;
}
#privat_menu a:hover {
    color: #fff;
    font: 16px "Palatino Linotype";
    text-decoration: underline;
}
#poker_menu {
    background: #0204a2;
    display: none;
    float: left;
    margin-left: 282px;
    margin-top: 130px;
    position: absolute;
    top: 35px;
    z-index: 3;
}
#poker_menu span div {
    display: block;
    padding: 2px 20px 2px 10px;
}
#poker_menu span div:hover {
    background: #3983f9;
}
#poker_menu a {
    color: #fff;
    font: 16px "Palatino Linotype";
    text-decoration: none;
}
#poker_menu a:hover {
    color: #fff;
    font: 16px "Palatino Linotype";
    text-decoration: underline;
}
/* Sidebar Left (левый сайд бар находится в нутри middle);
-----------------------------------------------------------------------------*/
#sideLeft {
    background: #b1f6b9;
    display: block;
    float: right;
    height: 100%;
    margin-right: -220px;
    position: relative;
    top: 44px;
    width: 215px;
    z-index: 1;
}
#calend {
    display: block;
    margin: 15px;
}
.zagolovok {
    background-image: url("images/vmenu_sb.png");
    background-repeat: no-repeat;
    color: white;
    font-size: 22px;
    font: Georgia, Geneva, sans-serif;
    height: 30px;
    padding: 2px 0px;
    text-align: center;
}
/* Footer;
-----------------------------------------------------------------------------*/
#footer {
    background: #b1f6b9;
    border-radius: 0px 0px 25px 25px;
    height: 50px;
    margin: -50px auto 0px;
    position: relative;
    width: 992px;
}
6
  • В firebug проверяли?
    – atnartur
    21 авг 2012 в 14:19
  • Нет, не проверял, поставил на сайт - не работает =(
    – Riolu
    21 авг 2012 в 14:24
  • 2
    @Riolu Уточните, что именно не работает. 21 авг 2012 в 14:33
  • 4
    для того, чтобы выявить ошибку скрипта нужно больше css
    – Spectre
    21 авг 2012 в 14:47
  • 1
    Ну вы прям,@Spectre, такое просите... Все коммерческие тайны тут узнать пытаетесь. Поди уже проект поднимаете и запустите игру раньше автора...
    – iKuzko
    21 авг 2012 в 14:55

1 ответ 1

2

Не знаю кто вас учил так работать с DOM, но попробуйте заменить строки

html = "<img src='images/items/item/" + item_id + ".png' border='0'><br>";
html = html + "<b>" + name + " x" + count + ".</b><p>" + description + ".</p>";
document.items_t.innerHTML = html;
document.items.style.left = position(event).x;
document.items.style.top = position(event).y;
document.items.style.display = "block";

на

html  = "<img src='images/items/item/" + item_id + ".png' border='0'/><br/>";
html += "<b>" + name + " x" + count + ".</b><p>" + description + ".</p>";
document.getElementById('items_t').innerHTML = html;
var itemsBlock = document.getElementById('items');
itemsBlock.style.left = position(event).x;
itemsBlock.style.top = position(event).y;
itemsBlock.style.display = "block";
1
  • спс все ра6отает =)
    – Riolu
    21 авг 2012 в 14:49

Ваш ответ

By clicking “Отправить ответ”, you agree to our terms of service and acknowledge you have read our privacy policy.

Всё ещё ищете ответ? Посмотрите другие вопросы с метками или задайте свой вопрос.