JSFiddle - React, Tailwind, and code Playground

HTML

<div id="hsBnr"></div>

JavaScript

function bannerCreater(opt){
	opt = opt || {};
	var h = opt.h,
		w = opt.w,
		link = opt.link,
		img = opt.img,
		title = opt.title,
		target = opt.target,
		attach = opt.attach,
		create = true,
		div = document.createElement('div'),
		result = '',
		words = '0123456789qwertyuiopasdfghjklzxcvbnmQWERTYUIOPASDFGHJKLZXCVBNM',
		max_position = words.length - 1,
		logging = opt.logging
	;
	for(i = 0; i < 10; ++i) {
		position = Math.floor (Math.random() * max_position);
		result = result + words.substring(position, position + 1);
	}
	var idgen = result;
	if (h == null) {
		h = 60;
	} else if (w == null) {
		w = 468;
	} else if (link == null) {
		console.error('Не указана ссылка, баннер не будет создан.');
		create = false;
	} else if (img == null) {
		console.error('Не указана ссылка на изображение, баннер не будет создан.');
		create = false;
	} else if (title == null) {
	
	} else if (target == null) {
		target = '_blank';
	} else if (attach == null) {
		console.error('Не указан id элемента, в который будет встроен баннер, баннер не будет создан.');
		create = false;
	} else if (logging == null){
		logging = false;
	}
	if (create == true) {
		div.setAttribute('id',idgen);
		div.setAttribute('style','width:'+w+'px !important;height:'+h+'px !important;background-image:url(\''+img+'\') !important;background-repeat:repeat repeat !important;background-position:center center !important;cursor:pointer !important;');
		if (title) {
			div.setAttribute('title',title);
		}
		div.setAttribute('onclick', 'window.open(\''+link+'\', \''+target+'\')',0);
		document.getElementById(attach).appendChild(div);
		if (logging == true){
			console.log('Успешно создан баннер для сайта '+link+' с ID: '+idgen+', размерами '+w+'x'+h+'px в блоке '+attach+'.');
		}
	}
}
bannerCreater({
	attach: 'hsBnr',
	w: 468,
	h: 60,
	link: 'http://coffeebreak.rusff.ru/',
	img: 'http://savepic.net/5248295.png',
	title: 'Ролевой Каталог CoffeeBreak',
	target: '_blank',
    logging: true
});