PDA

View Full Version : pop-ups and hit counters



chris9902
December 28th, 2002, 05:13 PM
ok how do i make a pop-up window like used on www.vicecity.com

so when you press the thumbnail it opens a window with the full picture inside but you control the size of the window that pop-up

and how do i make a hit counter that is just text, but displays the total page views and the days views

eg-------

total: 1093940
today: 10677

DDD
December 28th, 2002, 08:09 PM
You can do it with ASP and cookies. Do you need the code or advice?? I did not see a pop up window.

chris9902
December 28th, 2002, 08:49 PM
sorry...

when it loads go to 'screens' then click on a thumbnail

sorry my mistake

DDD
December 28th, 2002, 09:01 PM
Here Dreamweaver has cool utility that does this automatically so here is the code you can plug it in where you need it......Change the dimensions in "onClick" of the href.



<html>
<head>
<title>Untitled Document</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">


<!----########## Put this in the header #####----->
<script language="JavaScript" type="text/JavaScript">
<!--
function GP_AdvOpenWindow(theURL,winName,features,popWidth, popHeight,winAlign,ignorelink,alwaysOnTop,autoClos eTime,borderless) { //v2.0
var leftPos=0,topPos=0,autoCloseTimeoutHandle, ontopIntervalHandle, w = 480, h = 340;
if (popWidth > 0) features += (features.length > 0 ? ',' : '') + 'width=' + popWidth;
if (popHeight > 0) features += (features.length > 0 ? ',' : '') + 'height=' + popHeight;
if (winAlign && winAlign != "" && popWidth > 0 && popHeight > 0) {
if (document.all || document.layers || document.getElementById) {w = screen.availWidth; h = screen.availHeight;}
if (winAlign.indexOf("center") != -1) {topPos = (h-popHeight)/2;leftPos = (w-popWidth)/2;}
if (winAlign.indexOf("bottom") != -1) topPos = h-popHeight; if (winAlign.indexOf("right") != -1) leftPos = w-popWidth;
if (winAlign.indexOf("left") != -1) leftPos = 0; if (winAlign.indexOf("top") != -1) topPos = 0;
features += (features.length > 0 ? ',' : '') + 'top=' + topPos+',left='+leftPos;}
if (document.all && borderless && borderless != "" && features.indexOf("fullscreen") != -1) features+=",fullscreen=1";
if (window["popupWindow"] == null) window["popupWindow"] = new Array();
var wp = popupWindow.length;
popupWindow[wp] = window.open(theURL,winName,features);
if (popupWindow[wp].opener == null) popupWindow[wp].opener = self;
if (document.all || document.layers || document.getElementById) {
if (borderless && borderless != "") {popupWindow[wp].resizeTo(popWidth,popHeight); popupWindow[wp].moveTo(leftPos, topPos);}
if (alwaysOnTop && alwaysOnTop != "") {
ontopIntervalHandle = popupWindow[wp].setInterval("window.focus();", 50);
popupWindow[wp].document.body.onload = function() {window.setInterval("window.focus();", 50);}; }
if (autoCloseTime && autoCloseTime > 0) {
popupWindow[wp].document.body.onbeforeunload = function() {
if (autoCloseTimeoutHandle) window.clearInterval(autoCloseTimeoutHandle);
window.onbeforeunload = null; }
autoCloseTimeoutHandle = window.setTimeout("popupWindow["+wp+"].close()", autoCloseTime * 1000); }
window.onbeforeunload = function() {for (var i=0;i<popupWindow.length;i++) popupWindow[i].close();}; }
document.MM_returnValue = (ignorelink && ignorelink != "") ? false : true;
}
//-->
</script>
</head>

<body>

<!----###########put this code on your href tag ###################---->
<a href="#" onClick="GP_AdvOpenWindow('www.implod.com','newWindow','ful lscreen=no,toolbar=no,location=no,status=no,menuba r=no,scrollbars=no,resizable=no',300,300,'center', 'ignoreLink','',0,'');return document.MM_returnValue">text</a>
</body>
</html>

chris9902
December 28th, 2002, 09:16 PM
can you just point out were to add the URL of the thumbnail, the URL of the picture that it will open were i can change what size the window that opens is.

and what is.

<!----###########put this code on your href tag ###################---->
<a href="#" onClick="GP_AdvOpenWindow('www.implod. com','newWindow','fullscreen=no,toolbar=no,locatio n=no,status=no,menubar=no,scrollbars=no,resizable= no',300,300,'center','ignoreLink','',0,'');return document.MM_returnValue">text</a>
</body>
</html>

for

chris9902
December 28th, 2002, 09:25 PM
no i got it

thank you SO much

plz can you give me some details so i can thank you on my site

name:
site:

thanks again

PS do you like my site layout, (no content yet)

http://www.geocities.com/gta_games/index2.html

DDD
December 28th, 2002, 09:25 PM
"text" is where you would put your image for the link. If you put that whole thing in your editor and run it. I think you will know what I mean. here is a explanation.



<a href="#" onClick="GP_AdvOpenWindow('www.implod. com','newWindow','fullscreen=no,toolbar=no,locatio n=no,status=no,menubar=no,scrollbars=no,resizable= no',300,300,'center','ignoreLink','',0,'');return document.MM_returnValue">text</a>


a href ="#" *thisis a html reference tag leave the # this tells the cpu it is a null link you will tell the browser what to open later.

onClick ="" *this is telling the browser do what ever is in the quotes

GP_AdvOpenWindow('your url', *dont worry about the function part, but where I have your url put the url of your photos

'fullscreen=no,toolbar=no,locatio n=no,status=no,menubar=no,scrollbars=no,resizable= no' *these properties speak for them selves change them to yes if you want to use them***resizable=no'*** this is the one you had in mind leave this no and the user cannot resize.

300,300, This is the dimensions....change these to change the size of the window.

chris9902
December 28th, 2002, 09:32 PM
now can anyone help me with the hit counter

DDD
December 28th, 2002, 09:45 PM
It is not really necessary but my name is nathan and my url is www.implod.com Props are always cool. Do you wanna use asp for your counter??


Here is one I got from somewhere I forgot where but you can use it
put it in your code library so you can use it again. Paste this above your everything on the page even the header



<%
' Declare our vaiables
Dim objFSO, objCountFile ' object vars for FSO and File
Dim strCountFileName ' filename of count text file
Dim iCount ' count variable
Dim bUseImages ' boolean whether or not to use images
Dim I ' standard looping var


' Determine whether we use images or plain text
' You could just set this to True or False instead
bUseImages = CBool(Request.QueryString("images"))

' Compute our count file's filename
' This is based on the file from which you call count.asp
' It basically takes that name and appends a .cnt so I don't
' accidently overwrite any files. If for some reason you have
' a file named script_name.asp.cnt then change this or watch out!
strCountFileName = Server.MapPath(Request.ServerVariables("SCRIPT_NAME") & ".cnt")


' Create FileSystemObject to deal with file access
Set objFSO = Server.CreateObject("Scripting.FileSystemObject")

' Open the file as a text stream (1 = ForReading, True = Create)
Set objCountFile = objFSO.OpenTextFile(strCountFileName, 1, True)

' Read the current count from the file
If Not objCountFile.AtEndOfStream Then
' Set value to contents of the file
iCount = CLng(objCountFile.ReadAll)
Else
' If no file exists or it's empty start at 0
iCount = 0
End If

' Close the file and destroy the object
objCountFile.Close
Set objCountFile = Nothing


' Increment the count
iCount = iCount + 1


' Overwrite existing file and get a text stream to new one
Set objCountFile = objFSO.CreateTextFile(strCountFileName, True)

' Write updated count
objCountFile.Write iCount

' Close the file and destroy the object
objCountFile.Close
Set objCountFile = Nothing


' Destroy the FSO object
Set objFSO = Nothing


' We're all done with the hard part
' All that's left is to display the results
If bUseImages Then
' Loop through the count integer showing each digit
' You can grab the images one at a time or get the zip
' http://www.asp101.com/samples/download/counter_imgs.zip
For I = 1 to Len(iCount)
' Output the IMG tag using the right digit
Response.Write "<img src=""./images/digit_"
Response.Write Mid(iCount, I, 1)
Response.Write ".gif"" alt="""
Response.Write Mid(iCount, I, 1)
Response.Write """ width=""20"" height=""27"" />"
Next 'I
Else
' No image wanted just show the variable
Response.Write iCount
End If
%>