PDA

View Full Version : Watermark Background Image randomizer script



Rayban
02-13-2005, 12:24 AM
My goal is to have a page with a single image displayed and when the page is visited again it chooses a different picture.

Have the following script and on line the "if (document.all)" I keep getting A Runtime Error occurred: Unterminated string constant

The first picture displays but cannot figure out this Runtime error?

I'm using FP 2004.

<%@ Language="VBScript" %>
<% Option Explicit %>

<html>

<head>
<meta http-equiv="Content-Type" content="text/html;
charset=windows-1252">
<meta name="GENERATOR" content="Microsoft FrontPage 6.0">
<meta name="ProgId" content="FrontPage.Editor.Document">
<title>random</title>

<%
Randomize
dim num, picNum, ArrPics
ArrPics =
Array("media/picts/INDEX_images/1977_1.jpg","media/picts/INDEX_images/1980_1.jpg","media/picts/INDEX_images/1980_3.jpg"
picNum = 2
num = Round(Rnd*picNum)
%>

</head>

<p align="center">

<img src="<% Response.Write (ArrPics(num)) %>" alt=" ">

<script language="JavaScript1.2">

/*
Watermark Backgound Image Script-
) Dynamic Drive (www.dynamicdrive.com)
For full source code, installation instructions,
100's more DHTML scripts, and Terms Of
Use, visit dynamicdrive.com
*/

if (document.all)
document.body.style.cssText="url('media/picts/INDEX_images/1980_1.jpg')
no-repeat fixed center center"
</script>

<p align="center">
<a target="_blank" href="http://www.website.com/index.asp"><img border="0" src="media/picts/INDEX_images/1977_1.jpg"></a></p>

<p align="center">
<a target="_blank" href="http://www.website.com/index.asp">Blah Blah</a></p>

</html>

Thanks for your help!!!!

speedracer
02-15-2005, 01:04 PM
this line might be it:
document.body.style.cssText="url('media/picts/INDEX_images/1980_1.jpg')
no-repeat fixed center center"

it should be all in one line:
document.body.style.cssText="url('media/picts/INDEX_images/1980_1.jpg')no-repeat fixed center center"