ورود

توجه ! این یک نسخه آرشیو شده میباشد و در این حالت شما عکسی را مشاهده نمیکنید برای مشاهده کامل متن و عکسها بر روی لینک مقابل کلیک کنید : مشکل با قرار دادن کد های HTML , Javascript , CSS درون موقعیت ماژو



ittm
05-01-2009, 08:16 AM
سلام
من یک صفحه html را در یک موقعیت میخواهم نمایش دهم که از کدهای CSS ، Java و Html استفاده کرده است ولی در حالت عادی که ظاهرا تنظیمات css فایل را مامبو قبول نمیکند و صفحه را به هم میریزد ، یک ماژول برای نمایش html هم در جستجو پیدا کردم ولی لینک آن خراب بود ، ادیتور را هم غیر فعال کردم . کد را مستقیم قرار دادم که خروجی را در صفحه اول سایت نمایش میدهد ولی در آن موقعیت خاص نیست بلکه در بالای صفحه است !
در صورت امکان راهنمایی نمایید

سعید
05-01-2009, 01:02 PM
بالاخره مشخص نکردید که چه کدی ؟ css , java script یا ...

اگر css هست که بالا و پایین نداره !

ittm
05-01-2009, 01:26 PM
هم شامل کدهای css هست و هم در ادامه یک اسکریپت دارد

سعید
05-01-2009, 01:31 PM
کد را مستقیم قرار دادم که خروجی را در صفحه اول سایت نمایش میدهد


چه کدی؟

ittm
05-01-2009, 07:18 PM
ببینید کد این هست :


&lt;!DOCTYPE HTML PUBLIC &quot;-//W3C//DTD HTML 4.01//EN&quot; &quot;<b><font color=red>فقط کاربران عضو انجمن می توانند لینک ها را مشاهده کنند</font></b>
&lt;html&gt;
&lt;head&gt;
&lt;title&gt;7&lt;/title&gt;
&lt;meta <b><font color=red>فقط کاربران عضو انجمن می توانند لینک ها را مشاهده کنند</font></b> content=&quot;no&quot;&gt;
&lt;style type=&quot;text/css&quot;&gt;
html {
overflow: hidden;
}
body {
position: absolute;
margin: 0px;
padding: 0px;
background: #111;
width: 100%;
height: 100%;
}
#center {
position: absolute;
left: 50%;
top: 50%;
}
#slider {
position: absolute;
width: 472px;
height: 161px;
left: -201px;
top: -370px;
overflow: hidden;
background: #000;
border: 1px solid #000;
}
#slider .slide {
position: absolute;
top: 0px;
height: 333px;
width: 500px;
background: #000;
overflow: hidden;
border-left: #000 solid 1px;
cursor: default;
}
#slider .title {
color: #F80;
font-weight: bold;
font-size: 1.2em;
margin-right: 1.5em;
text-decoration: none;
}
#slider .backgroundText {
position: absolute;
width: 100%;
height: 100%;
top: 100%;
background: #000;
filter: alpha(opacity=40);
opacity: 0.4;
}
#slider .text {
position: absolute;
top: 1%;
top: 100%;
color: #FFF;
font-family: tahoma, arial, Helvetica, sans-serif;
font-size: 0.9em;
text-align: justify;
width: 470px;
left: 10px;
}
#slider .diapo {
position: absolute;
filter: alpha(opacity=100);
opacity: 1;
visibility: hidden;
}
&lt;/style&gt;

&lt;script type=&quot;text/javascript&quot;&gt;
/* ==== slider nameSpace ==== */
var slider = function() {
/* ==== private methods ==== */
function getElementsByClass(object, tag, className) {
var o = object.getElementsByTagName(tag);
for ( var i = 0, n = o.length, ret = &#91;]; i &lt; n; i++) {
if (o[i].className == className) ret.push(o[i]);
}
if (ret.length == 1) ret = ret[0];
return ret;
}
function setOpacity (obj,o) {
if (obj.filters) obj.filters.alpha.opacity = Math.round(o);
else obj.style.opacity = o / 100;
}
/* ==== Slider Constructor ==== */
function Slider(oCont, speed, iW, iH, oP) {
this.slides = &#91;];
this.over = false;
this.S = this.S0 = speed;
this.iW = iW;
this.iH = iH;
this.oP = oP;
this.oc = document.getElementById(oCont);
this.frm = getElementsByClass(this.oc, &#039;div&#039;, &#039;slide&#039;);
this.NF = this.frm.length;
this.resize();
for (var i = 0; i &lt; this.NF; i++) {
this.slides[i] = new Slide(this, i);
}
this.oc.parent = this;
this.view = this.slides[0];
this.Z = this.mx;
/* ==== on mouse out event ==== */
this.oc.onmouseout = function () {
this.parent.mouseout();
return false;
}
}
Slider.prototype = {
/* ==== animation loop ==== */
run : function () {
this.Z += this.over ? (this.mn - this.Z) * .5 : (this.mx - this.Z) * .5;
this.view.calc();
var i = this.NF;
while (i--) this.slides[i].move();
},
/* ==== resize ==== */
resize : function () {
this.wh = this.oc.clientWidth;
this.ht = this.oc.clientHeight;
this.wr = this.wh * this.iW;
this.r = this.ht / this.wr;
this.mx = this.wh / this.NF;
this.mn = (this.wh * (1 - this.iW)) / (this.NF - 1);
},
/* ==== rest ==== */
mouseout : function () {
this.over = false;
setOpacity(this.view.img, this.oP);
}
}
/* ==== Slide Constructor ==== */
Slide = function (parent, N) {
this.parent = parent;
this.N = N;
this.x0 = this.x1 = N * parent.mx;
this.v = 0;
this.loaded = false;
this.cpt = 0;
this.start = new Date();
this.obj = parent.frm[N];
this.txt = getElementsByClass(this.obj, &#039;div&#039;, &#039;text&#039;);
this.img = getElementsByClass(this.obj, &#039;img&#039;, &#039;diapo&#039;);
this.bkg = document.createElement(&#039;div&#039;);
this.bkg.className = &#039;backgroundText&#039;;
this.obj.insertBefore(this.bkg, this.txt);
if (N == 0) this.obj.style.borderLeft = &#039;none&#039;;
this.obj.style.left = Math.floor(this.x0) + &#039;px&#039;;
setOpacity(this.img, parent.oP);
/* ==== mouse events ==== */
this.obj.parent = this;
this.obj.onmouseover = function() {
this.parent.over();
return false;
}
}
Slide.prototype = {
/* ==== target positions ==== */
calc : function() {
var that = this.parent;
// left slides
for (var i = 0; i &lt;= this.N; i++) {
that.slides[i].x1 = i * that.Z;
}
// right slides
for (var i = this.N + 1; i &lt; that.NF; i++) {
that.slides[i].x1 = that.wh - (that.NF - i) * that.Z;
}
},
/* ==== HTML animation : move slides ==== */
move : function() {
var that = this.parent;
var s = (this.x1 - this.x0) / that.S;
/* ==== lateral slide ==== */
if (this.N &amp;&amp; Math.abs(s) &gt; .5) {
this.obj.style.left = Math.floor(this.x0 += s) + &#039;px&#039;;
}
/* ==== vertical text ==== */
var v = (this.N &lt; that.NF - 1) ? that.slides[this.N + 1].x0 - this.x0 : that.wh - this.x0;
if (Math.abs(v - this.v) &gt; .5) {
this.bkg.style.top = this.txt.style.top = Math.floor(2 + that.ht - (v - that.Z) * that.iH * that.r) + &#039;px&#039;;
this.v = v;
this.cpt++;
} else {
if (!this.pro) {
/* ==== adjust speed ==== */
this.pro = true;
var tps = new Date() - this.start;
if(this.cpt &gt; 1) {
that.S = Math.max(2, (28 / (tps / this.cpt)) * that.S0);
}
}
}
if (!this.loaded) {
if (this.img.complete) {
this.img.style.visibility = &#039;visible&#039;;
this.loaded = true;
}
}
},
/* ==== light ==== */
over : function () {
this.parent.resize();
this.parent.over = true;
setOpacity(this.parent.view.img, this.parent.oP);
this.parent.view = this;
this.start = new Date();
this.cpt = 0;
this.pro = false;
this.calc();
setOpacity(this.img, 100);
}
}
/* ==== public method - script initialization ==== */
return {
init : function() {
// create instances of sliders here
// parameters : HTMLcontainer name, speed (2 fast - 20 slow), Horizontal ratio, vertical text ratio, opacity
this.s1 = new Slider(&quot;slider&quot;, 12, 1.84/3, 1/3.2, 70);
setInterval(&quot;slider.s1.run();&quot;, 16);
}
}
}();

&lt;/script&gt;
&lt;meta <b><font color=red>فقط کاربران عضو انجمن می توانند لینک ها را مشاهده کنند</font></b> content=&quot;text/html; charset=utf-8&quot;&gt;&lt;/head&gt;

&lt;body&gt;
&lt;div id=&quot;center&quot;&gt;
&lt;div id=&quot;slider&quot;&gt;
&lt;div class=&quot;slide&quot;&gt;
&lt;img class=&quot;diapo&quot; src=&quot;sf10.jpg&quot; alt=&quot;&quot;&gt;
&lt;div class=&quot;text&quot;&gt;
&lt;span class=&quot;title&quot;&gt;تست&lt;/span&gt;
سلام خوش آمدید
&lt;/div&gt;
&lt;/div&gt;
&lt;div class=&quot;slide&quot;&gt;
&lt;img class=&quot;diapo&quot; src=&quot;sf14.jpg&quot; alt=&quot;&quot;&gt;
&lt;div class=&quot;text&quot;&gt;
&lt;span class=&quot;title&quot;&gt;تست&lt;/span&gt;
موسسه تست و گفتگو
&lt;/div&gt;
&lt;/div&gt;

&lt;div class=&quot;slide&quot;&gt;
&lt;img class=&quot;diapo&quot; src=&quot;sf04.jpg&quot; alt=&quot;&quot;&gt;
&lt;div class=&quot;text&quot;&gt;
&lt;span class=&quot;title&quot;&gt;تست&lt;/span&gt;
تست دوباره
&lt;/div&gt;
&lt;/div&gt;
&lt;div class=&quot;slide&quot;&gt;
&lt;img class=&quot;diapo&quot; src=&quot;sf01.jpg&quot; alt=&quot;&quot;&gt;
&lt;div class=&quot;text&quot;&gt;
&lt;span class=&quot;title&quot;&gt;تست&lt;/span&gt;
مجموعه تست دوستی
&lt;/div&gt;
&lt;/div&gt;
&lt;div class=&quot;slide&quot;&gt;
&lt;img class=&quot;diapo&quot; src=&quot;sf15.jpg&quot; alt=&quot;&quot;&gt;
&lt;div class=&quot;text&quot;&gt;
&lt;span class=&quot;title&quot;&gt;تست&lt;/span&gt;
موسسسه تست
&lt;/div&gt;
&lt;/div&gt;




&lt;/div&gt;
&lt;/div&gt;

&lt;script type=&quot;text/javascript&quot;&gt;
/* ==== start script ==== */
slider.init();
&lt;/script&gt;
&lt;/body&gt;
&lt;/html&gt;


این کد یک سری عکس را به صورت منویی بر روی هم به همراه متن نمایش میدهد و من میخواهم این کد را در موقعیت هدر سایت منتشر کنم ، همین !

سعید
05-01-2009, 07:41 PM
شما باید با html آشنا باشید که من احساس می کنم اینطور نیست.

شما وقتی این د رو قرار می دید، یعنی اینکه اول داکیومنت شماست !



&lt;!DOCTYPE HTML PUBLIC &quot;-//W3C//DTD HTML 4.01//EN&quot; &quot;<b><font color=red>فقط کاربران عضو انجمن می توانند لینک ها را مشاهده کنند</font></b>
&lt;html&gt;


قطعا کدی که در ماژول ها قرار می گیره ، بعد از ابتدای سند html هست و بنابراین قراردادن کدهایی که باید اول قرار بگیرند و تگ head در اونجا درست نیست.

ittm
05-02-2009, 05:56 AM
منظور شما اینست که از اول تگ Body باید در ماژول باشد و css و script را از داخل یک فایل دیگر بخواند ؟

سعید
05-02-2009, 06:09 AM
خیر منظور اینه که شما باید با html آشنایی داشته باشید !

ببینید تگ &lt;html&gt; ، &lt;head&gt; ، &lt;body&gt; اینها همه قبل از ماژول شما در سورس سایت شما اومدن !

این کدی که شما اینجا قرار دادید، سورس کامل html یک صفحه هست.

بهتره این صفحه رو ذخیره کنید و به صورت iframe در سایت نایش بدید.