My first javascript eg:onclick-photo gallery


    
    
image gallery

   
   

snap shots

choose an image

my tec my tec 2 my tec3 my tec4

html部分、

/** * Created by Administrator on 2016/5/25 0025. */
function showpic(whichpic) {    
var source = whichpic.getAttribute('href');    
var placeholder = document.getElementById('placeholder');    placeholder.setAttribute('src',source);    
var text = whichpic.getAttribute('title');    
var description = document.getElementById('description');    description.firstChild.nodeValue = text;
}
//下面的countBodyChildren元素计算的是body元素下有多少个子元素,使用的是notetype下的元素值即 1 。
function countBodyChildren() {    
var body_element = document.getElementsByTagName('body')[0];    alert(body_element.nodeType);}window.onload = countBodyChildren();

//打开一个新窗口函数
function popUp(winURL) {    window.open(winURL,'popup','width=300px,height=400px');
}
function prepareGallery() {
if(!document.getElementsByTagName)return false;    if(!document.getElementById)return false;    if(!document.getElementById('imageGallery'))return false;    
var gallery = document.getElementById('imageGallery');    gallery.getElementsByTagName('a');    
var links = gallery.getElementsByTagName('a');    
for(var i = 0; i

js部分

你可能感兴趣的:(My first javascript eg:onclick-photo gallery)