Bardziej chodziło mi o to żeby nie dostać bana wstawiając normalny link :)
Co do reklamy to potrzebuje więcej szczegółów.
Napisałem kod html:
<center>
<script type="text/javascript">
var src="www.jakisadresdoobrazka/obrazek.jpg";
var width=750;
var height=200;
</script>
<script type="text/javascript" src="http://adresdomojegoserwera/fly.js"></script>
</center>
wspomniany wyżej plik fly.js (który znalazłem w sieci) ma następującą zawartość:
var Floorad = {
divPrefix : "Div_",
typeName : "Floorad",
id : '',
wmode : ['window', 'opaque', 'transparent'][2],
scale : 'showall',
salign : 'left',
margin : ['auto', '0'][0],
timeout : 15,
//clickTagText : ['clickTag','clickTAG'][0],
clickTag : click || '',
width : width || '700',
height : height || '100',
src : src || '',
pix: pix
};
(function(c) {
c.id = c.id || (c.divPrefix + c.typeName + "_" +('' + Math.random()).substring(2, 8));
c.oid = c.oid || ('o_' + c.id);
c.wmode = c.wmode || ['opaque', 'window', 'transparent'][parseInt(c.useWindow*1)] || 'opaque';
c.margin = c.margin || '';
c.params = c.params || {};
c.flashvars = c.flashvars || {};
c.typ = c.typ || '';
c.style = c.style || '';
c.style && (c.style += c.style.match(/\;\s*$/) ? '' : ';');
c.style += c.margin ? ('margin:' + c.margin) : '';
var csi = c.src.indexOf('?');
if (csi > 0) {
c.clickTag = c.src.substring(csi + 1);
c.src = c.src.substring(0, csi);
}
c.base = c.src;
var lastCT = '';
if(c.clickTag) {
if(typeof c.clickTag == 'string') c.clickTag = c.clickTag.split('&');
for(var i = 0; i < c.clickTag.length; i++) {
lastCT = c.clickTag[i].split('=')[0];
c.flashvars[lastCT] = unescape(c.clickTag[i].substring(c.clickTag[i].indexOf('=') + 1));
}
}
function bfv(o, dont) {
var a = [];
for (var k in o) {
a.push((dont ? k : escape(k)) + '=' + (dont ? o[k] : escape(o[k])));
return a.join('&');
}
}
function buildParams (o) {
var a = [];
for (var k in o)
if (o[k])
a.push('<param name="' + k + '" value="' + o[k] +'" />');
return a.join('\n');
}
c.params.movie = c.src;
c.params.allowscriptaccess = 'always';
c.params.wmode = c.wmode;
if(!c.noBase) c.params.base = c.base;
c.params.flashvars = bfv(c.flashvars);
lastCT = lastCT || 'clickTag';
function buildPixs(pixs) {
var i = 0,
tab = [];
for (var i; i < pixs.length; i++)
if (pixs[i])
tab.push('<img src="' + pixs[i] + '" width="1" height="1" border="0" />');
return tab.join('\n');
}
var d = [document.getElementsByTagName("iframe"), document.getElementsByTagName("div"), document.getElementsByTagName("object"), document.getElementsByTagName("embed"), document.getElementsByTagName("img")];
var newPlacement = document.createElement('div');
newPlacement.style.position = 'absolute';
newPlacement.style.display = 'block';
newPlacement.style.left = '50%';
newPlacement.style.top = '10px';
newPlacement.style.marginLeft = ( - (Math.round(c.width)/2)) + "px";
newPlacement.innerHTML = ('<div id="' + c.id + '" style="overflow:hidden;clear:both;position:relative;top:0;width:' + c.width + 'px;'+ c.style + '">'
+ (c.src.match(/\.swf$/i) ?
('<object id="'+c.oid+'" style="display:block" type="application/x-shockwave-flash" data="' + c.src + '" width="' + c.width
+ '" height="' + c.height + '" class="netsales">' + "\n"
+ buildParams(c.params)
+ '</object>'
+ buildPixs(c.pix))
: (
'<a href="' + c.flashvars[lastCT] + '" target="_blank">'
+ '<img src="' + c.src
+ '" width="' + c.width
+ '" height="' + c.height + '" border="0">'
+ '</a>'
+ buildPixs(c.pix)
)
) + '</div>'
);
document.body.appendChild(newPlacement);
function doScroll(){
var e = document.getElementById(c.id); if(!e) {setTimeout(arguments.callee,0);return}
var timeout = null;
var closerVisible = false;
var clientHeight = (function() {
var el = (document.compatMode == 'CSS1Compat') ? 'documentElement' : 'body';
if(document[el].clientHeight == 0) el = el == 'documentElement' ? 'body' : 'documentElement';
return function() {
return document[el].clientHeight;
}
})();
function listener() {
if (c.x) return arguments.callee = function() {};
if(!clientHeight) return;
if (timeout) clearTimeout(timeout);
if (!e) return c.x = true; // bug?
if(!closerVisible) AddCloseButton();
var p = e.parentNode, initialOffset = p.offsetTop;
while (p = p.offsetParent) initialOffset += p.offsetTop;
var posStep, posStart = parseInt(e.style.top) || 0,
posEnd = parseInt(document.body.scrollTop || document.documentElement.scrollTop) || 0;
if (posEnd > 0) posEnd += 200;
var iniPosEnd = posEnd;
// dont scroll over the bottom!
var mmax = Math.max(0, posEnd - (c.height + 14) - initialOffset + clientHeight());
posEnd = Math.min(posEnd, mmax);
// dont scroll to high - the top edge of the ad over the top edge of the window
posEnd = Math.max(iniPosEnd - (initialOffset - 8), posEnd ) ;
//posEnd += 16;
e.style.top = Math.round(posStart + (posStep = (posEnd - posStart) /14)) + 'px';
if (parseInt(Math.abs(posStep))) timeout = setTimeout(arguments.callee, 50);
//else e.style.top = posEnd + 'px';
}
function AddCloseButton() {
var e = document.getElementById(c.id);
if (!e) return false;
// z-index:
e.style.zIndex = 99999;
var sp = document.createElement('div');
sp.innerHTML='<span style="font-weight:bold;font-style:normal;font-family:sans-serif;font-size:12px;color:black;background-color:white;letter-spacing:2px;position:relative;vertical-align:baseline">'
//+'<img style="clear:none;float:right;margin:0;padding:0;border:none;vertical-align:baseline" src="'+xpath+'x.png" alt="zamknij" />'
+'X ZAMKNIJ'
+'</span>';
sp.title = 'zamknij';
with(sp.style) {
cursor = 'pointer'; position = 'absolute'; top = '-16px'; right = 0; textAlign = 'right'; lineHeight = '16px'; fontSize = '12px';
}
sp.onclick = function () {
e.style.display = 'none'; c.x = true; sp.parentNode.removeChild(sp);
}
e.style.overflow = '';
e.appendChild(sp); closerVisible = true;
}
if (!window.addEventListener) {
window.addEventListener = function (evtName, callback) {
return window.attachEvent("on" + evtName, callback);
};
}
window.addEventListener("scroll", listener, true);
window.addEventListener("resize", listener, true);
}
doScroll();
})(Floorad);
niestety nie działa. czo muszę poprawić?
dodanie znaczników <code class="html"> i <code class="javascript">
- @furious programming