웹프로그래밍

Global It Leader!!


jQuery


 
 

링크에 마우스 올리면 소리나게 하기

페이지 정보

작성자 no_profile 오원장 쪽지보내기 메일보내기 자기소개 아이디로 검색 전체게시물 댓글 0건 조회 6,272회 작성일 11-04-05 20:18

본문

<html>
<head>
    <title>링크에 mouseover하게되면 소리출력</title>
</head>
<body>

<bgsound src="#" id="soundeffect" loop=1 autostart="true" />

<script type="text/javascript">
var soundfile="./err.wav"   //사운드파일경로

function playsound(soundfile){
    if (document.all && document.getElementById){
        document.getElementById("soundeffect").src=""
        document.getElementById("soundeffect").src=soundfile
    }
}

function bindsound(tag, soundfile, masterElement){
    if (!window.event) return
    var source=event.srcElement
    while (source!=masterElement && source.tagName!="HTML"){
    if (source.tagName==tag.toUpperCase()){
        playsound(soundfile)
    break
    }
    source=source.parentElement
    }
}
</script>

<B>레이어영역 DIV에 있을때</B><br>
<div id="coolmenu" onMouseover="bindsound('A', soundfile, this)">
    <a href="">menu #1</a><br>
    <a href="">menu #2</a><br>
    <a href="">menu #3</a><br>
</div>
<p>

<B>링크에 바로 사운드 연결 1 (소스에 설정된 사운드 파일 재생)</B></br>
<a href="#" onMouseover="playsound('./ding.wav')">Example 1</a><p>

<B>링크에 바로 사운드 연결 2 (링크에 다른 사운드 파일 재생)</B></br>
<a href="#" onMouseover="playsound('./err.wav')">Example 2</a>

본 소스를 실행하기 위해서는 ding.wav, err.wav에 해당하는 테스트용 사운드 파일이 있어야한다.

댓글목록

등록된 댓글이 없습니다.

전체 142
게시물 검색
jQuery 목록
번호 제목 글쓴이 조회 날짜
22 no_profile 오원장 쪽지보내기 메일보내기 자기소개 아이디로 검색 전체게시물 6676 07-26
21 no_profile 오원장 쪽지보내기 메일보내기 자기소개 아이디로 검색 전체게시물 5027 07-26
20 no_profile 오원장 쪽지보내기 메일보내기 자기소개 아이디로 검색 전체게시물 6258 06-14
19 no_profile 오원장 쪽지보내기 메일보내기 자기소개 아이디로 검색 전체게시물 5858 06-13
18 no_profile 오원장 쪽지보내기 메일보내기 자기소개 아이디로 검색 전체게시물 6006 06-09
17 no_profile 오원장 쪽지보내기 메일보내기 자기소개 아이디로 검색 전체게시물 6403 06-01
16 no_profile 오원장 쪽지보내기 메일보내기 자기소개 아이디로 검색 전체게시물 6036 05-30
15 no_profile 오원장 쪽지보내기 메일보내기 자기소개 아이디로 검색 전체게시물 5564 05-26
14 no_profile 오원장 쪽지보내기 메일보내기 자기소개 아이디로 검색 전체게시물 5658 05-13
13 no_profile 오원장 쪽지보내기 메일보내기 자기소개 아이디로 검색 전체게시물 6184 05-13
12 no_profile 오원장 쪽지보내기 메일보내기 자기소개 아이디로 검색 전체게시물 7577 05-07
11 no_profile 오원장 쪽지보내기 메일보내기 자기소개 아이디로 검색 전체게시물 6250 05-03
10 no_profile 오원장 쪽지보내기 메일보내기 자기소개 아이디로 검색 전체게시물 6802 04-29
열람중 no_profile 오원장 쪽지보내기 메일보내기 자기소개 아이디로 검색 전체게시물 6273 04-05
8 no_profile 오원장 쪽지보내기 메일보내기 자기소개 아이디로 검색 전체게시물 6231 12-16
7 no_profile 오원장 쪽지보내기 메일보내기 자기소개 아이디로 검색 전체게시물 6874 11-10
6 no_profile 오원장 쪽지보내기 메일보내기 자기소개 아이디로 검색 전체게시물 6267 10-03
5 no_profile 오원장 쪽지보내기 메일보내기 자기소개 아이디로 검색 전체게시물 8006 08-28
4 no_profile 오원장 쪽지보내기 메일보내기 자기소개 아이디로 검색 전체게시물 8331 06-15
3 no_profile 오원장 쪽지보내기 메일보내기 자기소개 아이디로 검색 전체게시물 6751 05-10