Jump to content
🌙 COLDPLAY ANNOUNCE MOON MUSIC OUT OCTOBER 4TH 🎵

Javascript Help


owenrees_73

Recommended Posts

if anyone knows anything about Javascript I have been stumped on this for weeks. I am very close with the following code but it is not working, can someone please help?

 

<HTML>

<HEAD>

<TITLE>New Wave Furniture</TITLE>

<SCRIPT LANGUAGE="JAVASCRIPT">

<!--Hide from old browsers

 

function addCookie(tag, value) {

var expireDate = new Date()

var expireString = ""

expireDate.setTime(expireDate.getTime() + (1000 * 60 * 60 * 24 * 365))

expireString = "expires=" + expireDate.toGMTString()

document.cookie = tag + "=" + escape(value) + ";" + expireString + ";"

}

 

function getCookie(tag) {

var value = null;

var myCookie = document.cookie + ";"

var findTag = tag + "="

var endPos

 

if (myCookie.length > 0) {

var beginPos = myCookie.indexOf(findTag)

if (beginPos != -1) {

beginPos += findTag.length

endPos = myCookie.indexOf(";", beginPos)

if (endPos == -1)

endPos = myCookie.length

value = unescape(myCookie.substring(beginPos, endPos))

}

}

return value

}

 

var CookieValue = 0

CookieValue= getCookie("VisitNumber")

if (CookieValue != null) {

CookieValue = parseInt(CookieValue) +1

}

else {

CookieValue = 1

}

addCookie("VisitNumber", CookieValue)

//-->

</SCRIPT>

</HEAD>

<BODY BGCOLOR="WHITE" TEXT="#00384A">

<TABLE WIDTH=100% BORDER=0>

<TR><TD ALIGN=LEFT>

chair.gif

</TD>

<TD ALIGN=RIGHT>

living.gif

</TD></TR>

</TABLE>

<H2 ALIGN="CENTER"><FONT COLOR="darkblue">New Wave Furniture</FONT></H2>

<CENTER>

Welcome to our Web page

 

 

<SCRIPT LANGUAGE="JAVASCRIPT">

<!--Hide from old browsers

 

var CookieValue= ""

 

CookieValue = getCookie("VisitNumber")

if(CookieValue != null) {

if(CookieValue == 1) {

document.write("<img src=newwave1.gif>")

}

 

if (CookieValue == 5) {

document.write("<img src=newwave5.gif>")

addCookie("VisitNumber", 1)

}

}

//-->

</SCRIPT>

</CENTER>

</BODY>

</HTML>

Link to comment
Share on other sites

  • 2 weeks later...

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now


×
×
  • Create New...