Eyes Of Siche
Guest book

이미지 롤오버

자자 역시 가장 흔하고 가장 간단한 이미지 롤오버 부터 고고싱~
<script type="text/javascript">
<!--
$(function(){
    $("img.imgRollOver").mouseover(function(){
        $(this).attr("src",$(this).attr("src").replace("_off","_on"));
    });
    $("img.imgRollOver").mouseout(function(){
        $(this).attr("src",$(this).attr("src").replace("_on","_off"));
    });
});
//-->
</script>
<img src="img1_off.gif" class="imgRollOver" />
<img src="img2_off.gif" class="imgRollOver" />
자자 attr(key, value) 이놈은 해당 객체의 속성에 원하는 값을 넣을수 있다. replace는 문자열을 치환하는 놈이고 즉, mouseover를 하면 해당 이미지의 src 값에 _off 라는 문자를 _on으로 바꾸 값을 해당 이미지의 src 값을 넣는다~~ 요거란 말이지~
out은 그 반대고~ 암튼 요딴식이다~

Posted by siche

2010/08/30 09:38 2010/08/30 09:38
, ,
Response
No Trackback , No Comment
RSS
http://eos.pe.kr/rss/response/172

Leave a comment
[로그인][오픈아이디란?]

innerHTML & 표시

생각하지도 못했다.. 이런 경우도 있군..
innerHTML를 했을때 & 표시가 안돼더라.. -_-;;

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title> eyes of siche</title>
</head>
<body>
<div id="div" style="height: 15px; border: 1px solid red"></div>
<br />
<input type="button" onclick="document.getElementById('div').innerHTML = '&'" value="click 1" />
<input type="button" onclick="document.getElementById('div').innerHTML = '&amp;'" value="click 2" />
<input type="button" onclick="document.getElementById('div').innerHTML = '&amp;amp;'" value="click 3" />
</body>
</html>

흠... 왜 이럴까... -_-;; 거참..
방법은 이렇지만 왜 이래야 하는지 모르겠다.. -_-;;

Posted by siche

2009/09/14 12:33 2009/09/14 12:33
, , ,
Response
No Trackback , No Comment
RSS
http://eos.pe.kr/rss/response/142

Leave a comment
[로그인][오픈아이디란?]

앞으로 뒤로 롤링 스크립트??

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title> eyes of siche </title>
<script type="text/javascript">
<!--
var rollSec1Now = 0;
var rollSecCountNow = 0;
var rollSecPlayNow = 1;
var rollSecPlayType;
var rollSecPlayer;
function rollSecInit(){
var imgList = document.getElementById('rollSec1').getElementsByTagName('li');
for(var i=0;i<imgList.length;i++){
imgList[i].style.left = document.getElementById('rollSec1').offsetWidth*i + rollSec1Now + 'px';
}
}
function rollSecPrev(click){
rollSecPlayNow = (click=='click')? 1 : 0 ;
rollSecPlay('stop');
rollSecCountNow--;
var count = document.getElementById('rollSec1').getElementsByTagName('li').length-1;
if(rollSecCountNow<0){
rollSecCountNow = count;
rollSec1Now = document.getElementById('rollSec1').offsetWidth * count * -1;
} else {
rollSec1Now = rollSec1Now + document.getElementById('rollSec1').offsetWidth;
}
rollSecInit();

if(click=='click') { rollSecPlay('stop', 'prev'); } else { rollSecPlay('start', 'prev'); } } function rollSecNext(click){ rollSecPlayNow = (click=='click')? 1 : 0 ; rollSecPlay('stop'); rollSecCountNow++; var count = document.getElementById('rollSec1').getElementsByTagName('li').length-1; if(rollSecCountNow>count){ rollSec1Now = 0; rollSecCountNow = 0; } else { rollSec1Now = rollSec1Now - document.getElementById('rollSec1').offsetWidth; } rollSecInit();

if(click=='click') { rollSecPlay('stop', 'next'); } else { rollSecPlay('start', 'next'); } }

function rollSecPlay(play, type){ rollSecInit(); rollSecPlayNow = (play=='stopBtn')? 0 : 1 ; if(type=='next'){ functionType = 'rollSecNext()'; rollSecPlayType = type; } else { functionType = 'rollSecPrev()'; rollSecPlayType = type; } (play=='start' && rollSecPlayNow==1)? rollSecPlayer = setInterval(functionType,1000) : clearTimeout(rollSecPlayer); } //--> </script> <style type="text/css"> #rollSec1 { position: relative; overflow: hidden; width: 300px; height: 300px; margin: 0; } #rollSec1 li { width: 300px; height: 300px; position: absolute; } #rollSec1 li.n1 { background-color: red; } #rollSec1 li.n2 { background-color: blue; } #rollSec1 li.n3 { background-color: yellow; } #rollSec1 li.n4 { background-color: gray; } #rollSec1 li.n5 { background-color: green; } div { text-align: center; border: 1px solid blue; width: 400px; padding: 50px 0; } a { margin-top: 20px; padding: 5px; border: 1px solid red; display: inline-block; } </style> </head>

<body> <div onmouseover="rollSecPlay('stop',rollSecPlayType);" onmouseout="rollSecPlay('start',rollSecPlayType);"> <ul id="rollSec1"> <li class="n1">1</li> <li class="n2">2</li> <li class="n3">3</li> <li class="n4">4</li> <li class="n5">5</li> </ul> <a href="javascript:;" onclick="rollSecPrev('click'); return false;">이전</a> <a href="javascript:;" onclick="rollSecNext('click'); return false;">다음</a> </div> <script type="text/javascript"> <!-- rollSecPlay('start','next'); //--> </script> </body> </html>


보통 롤링은 한방향으로 순차적으로 롤링이 된다 허나 이놈은 처음에 오른쪽으로 순차적으로 돌다가 마지막으로 이전을 눌렀으면 반대로 즉, 왼쪽으로 롤링이 되고 다음을 누르면 다시 처음과 같이 순차적으로 즉, 오른쪽으로 롤링이 된다.. -_-;;
그렇게 해달라고 해서 만들어서 쓰긴 했으나.... 왜 이런게 필요 한거야...?? -_-;;

난림으로 한달전쯤에 만들어 써서 기억도 잘 안나고.. 대충 정리만 해서 올린다.
스크립트 초초초초보를 위해 스크립트 중 rollSecPlay 함수 안쪽 제일 하단에 setInterval(functionType,1000) 요놈. 요놈 안에 1000 이놈은 1초를 의미 한다. 롤링 속도는 이놈을 맛깔나게 조절 필요.

Posted by siche

2009/09/02 14:15 2009/09/02 14:15
,
Response
No Trackback , No Comment
RSS
http://eos.pe.kr/rss/response/137

Leave a comment
[로그인][오픈아이디란?]
« 1 »
블로그 이미지

안돼는 것은 없다.. 항상 방법이 문제일 뿐이다.. 그 방법을 찾기 위해서는 노력할 뿐이다.. - siche

Archives

Recent Trackbacks

Calendar

«   2012/05   »
    1 2 3 4 5
6 7 8 9 10 11 12
13 14 15 16 17 18 19
20 21 22 23 24 25 26
27 28 29 30 31    

Site Stats

Total hits:
705382
Today:
17
Yesterday:
103