103、自制相册

103、自制相册

脚本说明:

把如下代码加入<body>区域中

<SCRIPT LANGUAGE="JavaScript"> var javascript_version = 1.0;</SCRIPT>

<SCRIPT LANGUAGE="JavaScript1.1">  javascript_version = 1.1;</SCRIPT>

<script language=javascript>

self.name = "main"; // names current window as "main"

 

PicVar = 0;

 

// Object Fix

 

function Fix(DatVal, PicVal, TitVal, TxtVal) {

 

   this.DatVal = DatVal

 

   this.PicVal = PicVal

 

   this.TitVal = TitVal

 

   this.TxtVal = TxtVal

 

}

 

// Create new main array.

 

var SuzyArray = new Array()

 

// The following lines are the ONLY LINES in this whole script that you need to change!

 

// SuzyArray[PicVar++] = new Fix("date", "picname.jpg", "pic title", "pic description")

 

SuzyArray[PicVar++] = new Fix("2/25/2003", "2003-02-25-27.jpg", "Our house in the snow", "I took this beautiful picture this morning. The streets are <i>one solid sheet of ice</i> right now! It's insane. I don't think we'll be driving anywhere soon.")

 

SuzyArray[PicVar++] = new Fix("1/5/2003", "2003-01-05-03.jpg", "Rain in the trees", "I had taken <b>Rainlin</b> out for a walk in the stroller, and we saw these cute little trees and stopped for a picture.")

 

SuzyArray[PicVar++] = new Fix("1/31/2003", "2002-12-31-01.jpg", "Scott and Suzy", "I asked one of our friends to take this picture for us. Could my handsome hubby's eyes get any more <b>blue?</b> :)")

 

SuzyArray[PicVar++] = new Fix("12/7/2002", "2002-12-07-05.jpg", "on the hayride", "Daddy was having a wonderful time on the hayride. Dylan wasn't too sure about it!")

 

SuzyArray[PicVar++] = new Fix("11/9/2002", "2002-11-09-09.jpg", "Boys on wheels", "Daddy was holding Dylan up <i>with his knees!</i> Those skates sure are hard to stand up in, but once he got the knack for it Dylan didn't want to take them off.")

 

SuzyArray[PicVar++] = new Fix("10/30/2002", "2002-10-30-01.jpg", "Dylan the Builder", "Here's Dylan, all dressed up and ready for Halloween! Everything in his life is Bob-the-builder related.")

 

SuzyArray[PicVar++] = new Fix("6/19/2002", "2002-06-19-07.jpg", "Jabba's face", "It's hard, really hard, to get a picture of Jabba's face without him charging the camera.")

 

SuzyArray[PicVar++] = new Fix("6/11/2002", "2002-06-11-11.jpg", "Rain behind the house", "The brick that makes up the outside of the house proved to be really pretty for framing pictures of the kidlets.")

 

SuzyArray[PicVar++] = new Fix("6/9/2002", "2002-06-09-04.jpg", "Scott and Rainlin", "I just had to take some pictures of them before church.  They looked so nice!")

 

SuzyArray[PicVar++] = new Fix("6/9/2002", "2002-06-09-01.jpg", "Rainlin and Susan", "We both wore our pretty blue flower dresses that Sunday.")

 

SuzyArray[PicVar++] = new Fix("6/7/2002", "2002-06-07-24.jpg", "Kaytlyn and Rainlin playing dress-up", "Kaytlyn has a whole bunch of dress-up clothes, and Rain loves to go over to her house and play dress-up with her.")

 

SuzyArray[PicVar++] = new Fix("6/2/2002", "2002-06-02-13.jpg", "The Three Amigos", "Dylan, Daddy, and Rainlin were watching Castaway on the couch.  We just moved all the furniture into that 'great room,' and everyone seems to like it better in there.")

 

SuzyArray[PicVar++] = new Fix("6/1/2002", "2002-06-01-09.jpg", "Simon", "For those of you who have never met him, this is Simon.  He's the tatoo I have on my left leg.  I drew everything of the tattoo except for his head, which came from a greeting card my mother sent me while I was in the military.")

 

last = PicVar - 1;

 

current = 0;

 

function ShowSuzyPic(newpic) {

 

// (not working on some browsers)   document.playsound.play();

 

  current = newpic;

 

  SelectionBox = document.SuzyForm.SuzyDropdown;

 

  SelectionBox.options[current].selected = true;

 

  document.getElementById("SuzySpot").innerHTML = '<a href=javascript:SuzyPicRemote("' + SuzyArray[current].PicVal + '","last");><img name="PicShowing" src=' + SuzyArray[current].PicVal + ' height=200 border=0></a>';

 

  document.getElementById("Journal").outerHTML = '<div id=journal><br>' + SuzyArray[current].DatVal + '<p style="text-align:justify; text-indent:25px">' + SuzyArray[current].TxtVal + '</div>';

 

  if (document.SuzyForm.WhereView[1].checked) {

 

    timerID = setTimeout("SuzyPicRemote(SuzyArray[current].PicVal,'current')",1000)

 

  }

 

}

 

function RandomSuzyPic() {

 

  randompic = Math.floor(Math.random()*PicVar);

 

  last = current;

 

  ShowSuzyPic(randompic);

 

}

 

function PreviousSuzyPic() {

 

  last = current;

 

  current--;

 

  if(current<0) current = PicVar - 1;

 

  ShowSuzyPic(current);

 

}

 

function NextSuzyPic() {

 

  last = current;

 

  TotalImages = document.SuzyForm.SuzyDropdown.options.length;

 

  current++;

 

  if (current>=PicVar) current = 0;

 

  ShowSuzyPic(current);

 

}

 

function SuzyPicRemote(picName,whichPic) {

 

    ShowingImage = new Image();

 

    ShowingImage.src = picName;

 

    wid = ShowingImage.width + 50;

 

    hei = ShowingImage.height + 50;

 

  if (wid < 30 || hei < 30) {

 

    wid=650;

 

    hei=490;

 

  }

 

  if (screen.width < wid || screen.height < hei) {

 

    wid = screen.width - 50;

 

    hei = screen.height - 50;

 

  }

 

  OpenWindow = window.open("http://www.kitykity.com/photoalbum/clear.html", "remoteWin", "resizable=1, scrollbars=1, toolbar=0, left=15, top=10, width=" + wid + ", height=" + hei);

 

  OpenWindow.document.write('<html><body background=parchment.jpg><img src=' + picName + '></body></html>');

 

  OpenWindow.document.close();

 

}

 

function FindPic() {

 

  TotalFound = 0;

 

  SearchString = document.SuzyForm.SearchWord.value;

 

  SearchString = SearchString.toLowerCase();

 

  WriteResults = window.open("clear.html","resultwindow","height=300, width=300, toolbar=0, status=0, menubar=0, resizable=1, scrollbars=1");

 

  WriteResults.document.open();

 

  WriteResults.document.write('<div style="text-align:center; font:8pt verdana">'

 

    + 'You searched for:<br><i>' + SearchString + '</i><br><b>Results:</b><br>');

 

  for (loop=0; loop < PicVar ; loop++) {

 

    Keyword = SuzyArray[loop].TxtVal;

 

    Keyword = Keyword.toLowerCase();

 

    URL = SuzyArray[loop].PicVal;

 

    title = SuzyArray[loop].TitVal;

 

    title = title.toLowerCase();

 

    SearchResult = Keyword.indexOf(SearchString);

 

    SearchResult2 = title.indexOf(SearchString);

 

    if (SearchResult != "-1" || SearchResult2 != "-1") {

 

      last = current;

 

      WriteResults.document.write('<br><a href=javascript:ShowSuzyPic(' + loop + '); target="main">' + title + '</a>');

 

      TotalFound++;

 

    }

 

  }

 

  WriteResults.document.write('<p><b>Returned ' + TotalFound + ' results.</b>');

 

  WriteResults.document.close();

 

  if(javascript_version > 1.0)  {

 

    //delay a bit here because IE4 encounters errors

 

    //when trying to focus a recently opened window

 

    setTimeout('WriteResults.focus();',250);

 

  }

 

 

 

}

 

// -->

 

</script>

<form name="SuzyForm">

 

<table border=0><tr><td>

 

<table style="padding:0px; margin:0px" border=0 cellspacing=0><tr align=center>

 

<td bgcolor=f9f9f9 style="background:url(parchment.jpg); width:275px; border-top:2px groove #888888;border-left:4px groove #888888;border-bottom:4px groove #888888; padding:10px;  margin:0px">

 

<div id="SuzySpot">

 

<script language=javascript>

 

document.write('<a href=javascript:SuzyPicRemote("' + SuzyArray[current].PicVal + '","last");><img name="PicShowing" src=' + SuzyArray[current].PicVal + ' height=200 border=0></a>');

 

</script>

</div>

</td>

<td style="background:url(parchmentring.jpg); width:36px; border-top:2px groove #888888; border-bottom:4px groove #888888" border=0> </td>

<td style="background:url(parchment.jpg); border-top:2px groove #888888; border-right:4px groove #888888; border-bottom:4px groove #888888; padding:5px; padding-right:20px; width:225px; font:8pt verdana; color:#000044; margin-left:0px" valign=top>

<div id="Journal">

<script language=javascript>

document.write('<br>' + SuzyArray[current].DatVal + '<p style="text-align:justify; text-indent:25px">' + SuzyArray[current].TxtVal);

</script>

</div>

</td>

</tr></table>

<p>

<table border=0><tr align=center>

<td>

<input type=button value="<<" onClick="PreviousSuzyPic();" style="font:8pt verdana,helvetica,arial; text-align:center">

<input type=button value="随机" onClick="RandomSuzyPic();" style="font:8pt verdana,helvetica,arial">

<input type=button value=">>" onClick="NextSuzyPic();" style="font:8pt verdana,helvetica,arial; text-align:center">

<p>

<SELECT size=12 style='font:8pt verdana' name='SuzyDropdown' onChange='ShowSuzyPic(SuzyForm.SuzyDropdown.options.selectedIndex);'>

<script language=javascript>

  TotalImages = PicVar;

  for (loop=0; loop < TotalImages; loop++)

  {

  document.write("<option value=" + SuzyArray[loop].PicVal + ">" + SuzyArray[loop].TitVal + "</option>");

  }

</script>

</SELECT>

</td>

<td style="padding-left:25px; font:8pt verdana">

<p style="text-align:left"><input type=radio name="WhereView" value="chkLocal" CHECKED>- 在本页浏览图片

<br><input type=radio name="WhereView" value="chkRemote">- 在弹出窗口浏览图片</p>

<p>搜索图片:

  <br><input name="SearchWord" size=10 style="font:8pt verdana">

  <br><input type="button" value="查找" onClick="javascript:FindPic();" style="font:8pt verdana">

</td></tr></table>

</td></tr></table>

</FORM>

<p><SCRIPT Language="Javascript">

document.write("总共有  " + PicVar + "  张图片。最后更新:  " + document.lastModified +".");

</script>

 

Write a comment

Comments: 0