ashkiisalt
Guppy
THis code runs fine on my server,
when I upload it I get a Error
Line: 9
Char: 9
Error: Object Expected ';'
Code: 0
I can create the error on my box when I try to preview it on frontpage.
Any suggestions?????
thumbs.htm
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<html>
<head>
<title>JavaScript Image Popup's Done Right</title>
<script language="javascript">
<!--
//------- popImg() ---------------------------------------
//-- Input : (iName) - the name of the large image to be shown in the popup
//-- Options : (pInfo) - These are for the base window settings when opened
//--------------------------------------------------------------
function popImg(iName) {
var pURL='popup.aspx?pi='+iName;
pInfo='toolbar=0,';
pInfo+='location=0,';
pInfo+='directories=0,';
pInfo+='status=0,';
pInfo+='menubar=0,';
pInfo+='scrollbars=0,';
pInfo+='resizable=1,';
pInfo+='width=384,';
pInfo+='height=576';
window.open(pURL, 'bigPop', pInfo);
}
//-->
</script>
</head>
<body>
Click the thumbnail for a larger image.<br>
<a href="javascriptopImg('maria/mv1.jpg');"><img src="images/maria/t1.jpg" border="0" height="100" width="67"></a>
</body>
</html>
popup.aspx
<%@ Page Language="vb" %>
<%@ Import Namespace="System.IO" %>
<%@ Import Namespace="System.Drawing.Imaging" %>
<%@ Import Namespace="System.Drawing" %>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<script runat=server>
sub page_load
'-- The default text if no querystring is passed.
wPanel.Text = "Requested image does not exist"
'-- first check to see if a querysting is present
If Request.QueryString IS String.Empty Then
'- do nothing
Else
wPanel.Text = getImagePop(Request.QueryString("pi"))
End If
end sub
'-- This grabs the image size from the file information and resizes the window
Function getImagePop(ByVal imageName As String) As String
'-- The StringBuilder class for better string concatenation performance.
Dim iStr As New StringBuilder("")
'-- The image width
Dim iH As Integer = 0
'-- The image height
Dim iW As Integer = 0
'-- The path to your larger images
Dim imagePath As String = "/images/"
'-- check to see if the image exists
If File.Exists(Server.MapPath(imagePath + imageName)) = True Then
Dim ti As System.Drawing.Image = ti.FromFile(Server.MapPath(imagePath + imageName))
'-- Get the height and width and add 0px of padding
iH = ti.Height + 0
iW = ti.Width + 0
'-- Create the image tag and the JavaScript resize code
iStr.Append("<div align=""absolute"">")
iStr.Append("<img src=" + Chr(34) + imagePath + imageName + Chr(34))
iStr.Append(" alt=""Pop Up"" title=""Pop Up"" border=""0""></div>")
iStr.Append("<script language=javascript>" + vbCrLf)
iStr.Append("<!--" + vbCrLf)
iStr.Append("window.resizeTo(" + iW.ToString + "," + iH.ToString + ");" + vbCrLf)
iStr.Append("-->" + vbCrLf)
iStr.Append(Chr(60) + "/script/" + Chr(62) + vbCrLf)
Else
iStr.Append("Whoops... I don't quite know what you were expecting to see here.")
End If
'-- Convert the StringBuilder to a String and return the value.
Return iStr.ToString
End Function
</script>
<HTML>
<HEAD>
<title>Home Page</title>
<meta name="GENERATOR" content="Microsoft Visual Studio .NET 7.1">
<meta name="CODE_LANGUAGE" content="Visual Basic .NET 7.1">
<meta http-equiv="imagetoolbar" content="no">
</HEAD>
<body topmargin="0" marginheight="0" leftmargin="0" marginwidth="0">
<asp:literal id="wPanel" Runat="server" EnableViewState="False"></asp:literal>
</body>
</HTML>
when I upload it I get a Error
Line: 9
Char: 9
Error: Object Expected ';'
Code: 0
I can create the error on my box when I try to preview it on frontpage.
Any suggestions?????
thumbs.htm
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<html>
<head>
<title>JavaScript Image Popup's Done Right</title>
<script language="javascript">
<!--
//------- popImg() ---------------------------------------
//-- Input : (iName) - the name of the large image to be shown in the popup
//-- Options : (pInfo) - These are for the base window settings when opened
//--------------------------------------------------------------
function popImg(iName) {
var pURL='popup.aspx?pi='+iName;
pInfo='toolbar=0,';
pInfo+='location=0,';
pInfo+='directories=0,';
pInfo+='status=0,';
pInfo+='menubar=0,';
pInfo+='scrollbars=0,';
pInfo+='resizable=1,';
pInfo+='width=384,';
pInfo+='height=576';
window.open(pURL, 'bigPop', pInfo);
}
//-->
</script>
</head>
<body>
Click the thumbnail for a larger image.<br>
<a href="javascriptopImg('maria/mv1.jpg');"><img src="images/maria/t1.jpg" border="0" height="100" width="67"></a>
</body>
</html>
popup.aspx
<%@ Page Language="vb" %>
<%@ Import Namespace="System.IO" %>
<%@ Import Namespace="System.Drawing.Imaging" %>
<%@ Import Namespace="System.Drawing" %>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<script runat=server>
sub page_load
'-- The default text if no querystring is passed.
wPanel.Text = "Requested image does not exist"
'-- first check to see if a querysting is present
If Request.QueryString IS String.Empty Then
'- do nothing
Else
wPanel.Text = getImagePop(Request.QueryString("pi"))
End If
end sub
'-- This grabs the image size from the file information and resizes the window
Function getImagePop(ByVal imageName As String) As String
'-- The StringBuilder class for better string concatenation performance.
Dim iStr As New StringBuilder("")
'-- The image width
Dim iH As Integer = 0
'-- The image height
Dim iW As Integer = 0
'-- The path to your larger images
Dim imagePath As String = "/images/"
'-- check to see if the image exists
If File.Exists(Server.MapPath(imagePath + imageName)) = True Then
Dim ti As System.Drawing.Image = ti.FromFile(Server.MapPath(imagePath + imageName))
'-- Get the height and width and add 0px of padding
iH = ti.Height + 0
iW = ti.Width + 0
'-- Create the image tag and the JavaScript resize code
iStr.Append("<div align=""absolute"">")
iStr.Append("<img src=" + Chr(34) + imagePath + imageName + Chr(34))
iStr.Append(" alt=""Pop Up"" title=""Pop Up"" border=""0""></div>")
iStr.Append("<script language=javascript>" + vbCrLf)
iStr.Append("<!--" + vbCrLf)
iStr.Append("window.resizeTo(" + iW.ToString + "," + iH.ToString + ");" + vbCrLf)
iStr.Append("-->" + vbCrLf)
iStr.Append(Chr(60) + "/script/" + Chr(62) + vbCrLf)
Else
iStr.Append("Whoops... I don't quite know what you were expecting to see here.")
End If
'-- Convert the StringBuilder to a String and return the value.
Return iStr.ToString
End Function
</script>
<HTML>
<HEAD>
<title>Home Page</title>
<meta name="GENERATOR" content="Microsoft Visual Studio .NET 7.1">
<meta name="CODE_LANGUAGE" content="Visual Basic .NET 7.1">
<meta http-equiv="imagetoolbar" content="no">
</HEAD>
<body topmargin="0" marginheight="0" leftmargin="0" marginwidth="0">
<asp:literal id="wPanel" Runat="server" EnableViewState="False"></asp:literal>
</body>
</HTML>