КреатиВ.ТуТ

Информация о пользователе

Привет, Гость! Войдите или зарегистрируйтесь.


Вы здесь » КреатиВ.ТуТ » IPB 1.3 » Погода в регионах


Погода в регионах

Сообщений 1 страница 4 из 4

1

Я тут нашел и доделал код, с помощью которого можно отслеживать погоду в разных регионах (А изначально - для создания ссылок) - при наведении мышой на текст под надписью появляется скрытый текст(или картинка)

Вот этот код можно вставлять куда угодно, где он больше нужен

Код:
<script language="JavaScript" type="text/javascript">

function lib_bwcheck(){ //Browsercheck (needed)
	this.ver=navigator.appVersion
	this.agent=navigator.userAgent
	this.dom=document.getElementById?1:0
	this.opera5=this.agent.indexOf("Opera 5")>-1
	this.ie5=(this.ver.indexOf("MSIE 5")>-1 && this.dom && !this.opera5)?1:0; 
	this.ie6=(this.ver.indexOf("MSIE 6")>-1 && this.dom && !this.opera5)?1:0;
	this.ie4=(document.all && !this.dom && !this.opera5)?1:0;
	this.ie=this.ie4||this.ie5||this.ie6
	this.mac=this.agent.indexOf("Mac")>-1
	this.ns6=(this.dom && parseInt(this.ver) >= 5) ?1:0; 
	this.ns4=(document.layers && !this.dom)?1:0;
	this.bw=(this.ie6 || this.ie5 || this.ie4 || this.ns4 || this.ns6 || this.opera5 || this.opera7)
	return this
}
var bw=new lib_bwcheck()


if(document.layers){ //NS4 resize fix...
	scrX= innerWidth; scrY= innerHeight;
	onresize= function(){if(scrX!= innerWidth || scrY!= innerHeight){history.go(0)} }
}


msgFont= "arial,helvetiva"	// The font for the message
msgFontSize= 12    // Set the fontSize in px
msgFontColor="#ff0000"  // Set the fontColor
msgWidth= "300"    // Set the width of the messageblock here for netscape 4

//Set the text you want to display on mouseover here.
messages=new Array()
messages[0]="Погода в Петербурге:<br><a href=\"http://www.rp5.ru/town.php?id=9487\" target=\"_blank\"><img src=\"http://www.rp5.ru/informer.php?id=9487&bc=990000\" alt=\"Погода на rp5.ru\" width=\"100\" height=\"100\" border=\"0\"></a>"
messages[1]="<img src=\"http://www.rp5.ru/informer.php?id=5483&bc=CC0033\" width=\"100\" height=\"100\" border=\"0\">"
messages[2]="<img src=\"http://www.rp5.ru/informer.php?id=5797&bc=CC3300\" width=\"100\" height=\"100\" border=\"0\">"
messages[3]="<img src=\"http://www.rp5.ru/informer.php?id=8955\" width=\"100\" height=\"100\" border=\"0\"></a>"
messages[4]="<img src=\"http://www.rp5.ru/informer.php?id=2374&bc=339966\" width=\"100\" height=\"100\" border=\"0\">"
messages[5]="<img src=\"http://www.rp5.ru/informer.php?id=8935\" width=\"100\" height=\"100\" border=\"0\">"
messages[6]="<img src=\"http://www.rp5.ru/informer.php?id=6290\" width=\"100\" height=\"100\" border=\"0\">"
messages[7]="<img src=\"http://www.rp5.ru/informer.php?id=7259\" width=\"100\" height=\"100\" border=\"0\">"


function makeChangeTextObj(obj){
    this.css = bw.dom?document.getElementById(obj).style:bw.ie4?document.all[obj].style:bw.ns4?document.layers[obj]:0;	
    this.writeref = bw.dom?document.getElementById(obj):bw.ie4?document.all[obj]:bw.ns4?document.layers[obj].document:0;	
	this.writeIt = b_writeIt;    	
}
function b_writeIt(text,num){
	if (bw.ns4){
  this.writeref.write(text)
  this.writeref.close()
	}
    else this.writeref.innerHTML = messages[num]
}

//The mouoseover function. Calls the writeIt method to write the text to the div.
function changeText(num){
	if(bw.bw) oMessage.writeIt('<table width="'+msgWidth+'" border="0" cellpadding="0" cellspacing="0"><tr><td><span style="font-size:'+msgFontSize+'px; font-family:'+msgFont+'; color:'+msgFontColor+'">'+messages[num]+'</span></td></tr></table>', num)
}

//The init function. Calls the object constructor and initiates some properties.
function changeTextInit(){
	//Fixing the browsercheck for opera... this can be removed if the browsercheck has been updated!!
	bw.opera5 = (navigator.userAgent.indexOf("Opera")>-1 && document.getElementById)?true:false
	if (bw.opera5) bw.ns6 = 0
	
	oMessage = new makeChangeTextObj('divMessage')
	oLinks = new makeChangeTextObj('divLinks')
	//Setting the style properties of the text layer.
	if(bw.dom || bw.ie4){
  with(oMessage.writeref.style){fontFamily=msgFont; fontSize=msgFontSize+"px"; color=msgFontColor}
	}
	//Both layers are hidden by default to prevent users from mousing over them and creating errors while the page loads.
	oMessage.css.visibility= "visible"
	oLinks.css.visibility= "visible"
}

//If the browser is ok, the init function is called on pageload. 
if (bw.bw) onload = changeTextInit
</script>

<div id="divLinks">
<a href="http://www.rp5.ru/town.php?id=5483" target="_blank" onmouseover="changeText(1)" onmouseout="changeText(0)">Москва</a>
<a href="http://www.rp5.ru/town.php?id=5797" target="_blank" onmouseover="changeText(2)" onmouseout="changeText(0)">Нижний Новгород</a>
<a href="http://www.rp5.ru/town.php?id=8955" target="_blank" onmouseover="changeText(3)" onmouseout="changeText(0)">Челябинск</a>
<a href="http://www.rp5.ru/town.php?id=2374" target="_blank" onmouseover="changeText(4)" onmouseout="changeText(0)">Воронеж</a>
<a href="http://www.rp5.ru/town.php?id=8935" target="_blank" onmouseover="changeText(5)" onmouseout="changeText(0)">Чебоксары</a>
<a href="http://www.rp5.ru/town.php?id=6290" target="_blank" onmouseover="changeText(6)" onmouseout="changeText(0)">Омск</a>
<a href="http://www.rp5.ru/town.php?id=7259" target="_blank" onmouseover="changeText(7)" onmouseout="changeText(0)">Самара</a>
</div>

<div id="divMessage">
<font face="arial,helvetica,sans-serif" size="2" color="#ff0000">
Это табличка погоды. Наведите курсором на интересующий Вас город и (позможно после небольшой паузы) увидите картинку с погодой.
Если у вас она не работает - не судьба!
</font>
</div>

ТК я из петербурга, то у меня соответственно и стоит питер.

Вообщем разберетесь  ;)

если захотите

0

2

Хорошая идея =)

Из текста видны сами информеры:

Простая динамическая картинка, вставляя код которой на страничку, получаем определенный информер.
<img src='http://www.rp5.ru/informer.php?id=9487&bc=990000' />
[doHTML]<img src='http://www.rp5.ru/informer.php?id=9487&bc=990000' />[/doHTML]

<img src='http://www.rp5.ru/informer.php?id=5483&bc=CC0033' />
[doHTML]<img src='http://www.rp5.ru/informer.php?id=5483&bc=CC0033' />[/doHTML]

<img src='http://www.rp5.ru/informer.php?id=7259' />
[doHTML]<img src='http://www.rp5.ru/informer.php?id=7259' />[/doHTML]

<img src='http://www.rp5.ru/informer.php?id=2374&bc=339966' />
[doHTML]<img src='http://www.rp5.ru/informer.php?id=2374&bc=339966' />[/doHTML]

Отредактировано ExperT (2006-02-07 23:34:44)

0

3

А так, мне кажется, практичнее, когда они убираются

Да и вообще - интереснее!

А сами информеры - как спб в моем примере - и ссылка и то и се

0

4

www.informer.ru
Каталог различных информеров..

0


Вы здесь » КреатиВ.ТуТ » IPB 1.3 » Погода в регионах