[Webinar] Learn how to a build a cloud-first strategyRegister Now

x
?
Solved

non-coder needs help adding link to open new browser with enlarged image

Posted on 2008-11-08
10
Medium Priority
?
1,292 Views
Last Modified: 2012-05-05
I need to know where to put code I recieved from experts.  Since the pages are not the same as they appear in "view source"  in my browser because they are dynamicly generated.   I want to be able to view my whole image (now the horizontal orientated artworks are partly covered unless you drag them in the zoom box).
See:  http://amariahart.com/itemDetails.aspx?id=10000003
So I asked for code for a link to bring up a new browser page with the full size image.  Here is what I got from the experts:  You can add a link like this under each of the thumbnails.

<a href="javascript: window.open('/test.jpg','_blank','height=800,width=1200')">View Full Size</a>


Replace the 'test.jpg' with the name of the full-size image.
Replace the height and width with the actual height and width you wish to display the image at.
Then, when a user clicks the link, it will open the image in a new window.  The '_blank' tells it to open in a new window.

For example, in the code on the page you specified you have a thumbnail link

<img src="http://www.amariahart.com/art/1e56883b-d96a-48dd-acb1-903c25100ee1_t.jpg" onclick="javascript: LoadImage('0ca92441-ec36-4457-b2d0-43c27178f24d_c.jpg')" />

This link says 'show the thumbnail 1e56883b-d96a-48dd-acb1-903c25100ee1_t.jpg and when it is clicked on, load the full image '0ca92441-ec36-4457-b2d0-43c27178f24d_c.jpg' in your draggable window. So, display this link under it

<a href="javascript: window.open('0ca92441-ec36-4457-b2d0-43c27178f24d_c.jpg','_blank','height=800,width=1200')">View Full Size</a>

BigDaddy: Please use onClick on links and return false!!!


<a href="/test.jpg" target="_blank" onClick="window.open(this.href,this.target,'height=800,width=1200'); return false">View Full Size</a>

 Now I need to know where to put this code.  The page where I think it should be is: itemDetails.axpx
I have attached the whole page code.  Let me know what page I could find it on and I will post if this doesn't do the trick.  
  There is also a page itemDetails.aspx.cs  
 
 

<%@ Page Language="C#" MasterPageFile="~/MasterPage.master" AutoEventWireup="true" CodeFile="itemDetails.aspx.cs" Inherits="itemDetails" Title="Item Details" %>
 
<%@ Register Assembly="DevExpress.Web.v7.3, Version=7.3.7.0, Culture=neutral, PublicKeyToken=9b171c9fd64da1d1"
	Namespace="DevExpress.Web.ASPxTabControl" TagPrefix="dxtc" %>
<%@ Register Assembly="DevExpress.Web.v7.3, Version=7.3.7.0, Culture=neutral, PublicKeyToken=9b171c9fd64da1d1"
	Namespace="DevExpress.Web.ASPxPopupControl" TagPrefix="dxpc" %>
 
<asp:Content ID="Content2" ContentPlaceHolderID="cpMain" Runat="Server">
	<input type="hidden" id="hdItemID" value="" runat="server" />
	<span id="spnItemTitle" style="font-size:14pt;font-weight:bold;" runat="server"></span>
	<br clear="all" />
	<div style="float:left;">
		<table border="0">
		<tr>
			<td style="vertical-align:top;">
				<div id="imgContent" style="position:absolute;vertical-align:bottom;text-align:center;float: left;overflow:hidden;margin-right:10px;height:500px;width:500px;padding:10px 10px 10px 10px;border:1px solid #555;background-color:white">
					<div id="imgZoom">
						<img id="imgItem" src="~/images/1x1.gif" dragEnabled style="position:absolute;top:0;left:0;z-index:0;cursor:pointer;" runat="server" alt="" />
					</div>
					<div id="divImgControls" style="position:absolute;top:460px;left:10px;height:50px;width:100px;border:1px solid silver;z-index:999;background-color:White;">
						<span class="text3d"><b>Zoom</b></span>
						<div style="float:left;padding:4px;margin-left:15px;cursor:pointer;" onclick="javascript: zoomImg(1);"><img id="imgZoomIn" src="~/images/zoomin.jpg" runat="server" /></div>
						<div style="float:left;padding:4px;cursor:pointer;" onclick="javascript: zoomImg(-1);"><img id="imgZoomOut" src="~/images/zoomout.jpg" runat="server" /></div>
					</div>
				</div>
				<br clear="all" />
				<div style="margin-top:530px;">
				<span class="text3d">
					Click <b>+</b> or <b>-</b> to zoom. Click and drag the image to view detail.
				</span>
				</div>
				<br clear="all" />
				<div id="divAdditionalImages" style="text-align:center;margin-right:10px;margin-top:10px;width:500px;padding:10px 10px 10px 10px;background-color:white;border:1px solid #555;" runat="server">
					
				</div>
			</td>
		</tr>
		</table>
	</div>
	<div style="float:left;">
		<table border="0">
		<tr>
			<td style="vertical-align:top;">
				<div style="height:170px;">
					<table class="tblForm">
					<tr>
						<td class="formField">Title:</td>
						<td class="dataField"><span id="spnTitle" runat="server"></span></td>
					</tr>
					<tr>
						<td class="formField">Artist:</td>
						<td class="dataField"><span id="spnArtist" runat="server"></span></td>
					</tr>
					<tr>
						<td class="formField">Theme:</td>
						<td class="dataField"><span id="spnTheme" runat="server"></span></td>
					</tr>
					<tr>
						<td class="formField">Medium:</td>
						<td class="dataField"><span id="spnMedium" runat="server"></span></td>
					</tr>
					<tr>
						<td class="formField">Size:</td>
						<td class="dataField"><span id="spnSize" runat="server"></span></td>
					</tr>
					<tr>
						<td class="formField">Price:</td>
						<td class="dataField"><span id="spnPrice" runat="server"></span></td>
					</tr>
					</table>
					<div id="divItemButtons" runat="server" style="margin-top:10px;">
						<b>Quantity:</b>&nbsp;<asp:textbox CssClass="textbox" id="txtQty" width="35px" Text="1" runat="server" maxlength="5" />
						<asp:button ID="btnAddToCart" CssClass="buttonSkinL L" runat="server" OnClick="btnAddItem_Click" text="Purchase" />
					</div>
				</div>
				<asp:button ID="btnShowMessage" runat="server" Text="Show Message" OnClientClick="javascript: return false;" style="display:none;" />
				<dxtc:ASPxPageControl ID="ASPxPageControl1" runat="server" ActiveTabIndex="0"
					Height="350px" Width="400px">
					<ActiveTabStyle Border-BorderColor="#dd0000" HoverStyle-BackColor="#dd0000" BackColor="#dd0000" ForeColor="white" Font-Bold="true"></ActiveTabStyle>
					<TabStyle BackColor="#dddddd" ForeColor="#999999" Font-Bold="true" HoverStyle-BackColor="#eeeeee"></TabStyle>
					<TabPages>
						<dxtc:TabPage Text="Artist Inspiration">
							<Controls>
								<div style="height:300px;overflow-y:auto;">
									<span id="spnInspiration" style="font-size:10pt;" runat="server"></span><br /><br />
									<div style="text-align:center;"><span class="text4d"><b><i>Artist inspiration text is printed on coordinated, framed parchment paper and comes with your piece.</i></b></span></div>
								</div>
							</Controls>
						</dxtc:TabPage>
						<dxtc:TabPage Text="Description">
							<Controls>
								<div style="height:300px;overflow-y:auto;"><span id="spnDescription" style="font-size:10pt;" runat="server"></span></div>
							</Controls>
						</dxtc:TabPage>
						<dxtc:TabPage Text="Delivery">
							<Controls>
								<div style="height:300px;overflow-y:auto;"><span id="spnDelivery" style="font-size:10pt;" runat="server"></span></div>
							</Controls>
						</dxtc:TabPage>
					</TabPages>
				</dxtc:ASPxPageControl>
				
				
			</td>
		</tr>
		</table>
	</div>
	
	<dxpc:ASPxPopupControl ID="popPurchaseItem" runat="server" PopupElementID="btnShowMessage" 
		HeaderText="Item Added" EnableAnimation="false" PopupAction="LeftMouseClick"
		PopupHorizontalAlign="Center" PopupVerticalAlign="Below" PopupVerticalOffset="100" 
		EnableClientSideAPI="true" HeaderStyle-HorizontalAlign="left" 
		ClientInstanceName="popPurchaseItem" Width="400px">
		<ContentStyle HorizontalAlign="Left" VerticalAlign="Top">
		</ContentStyle>
		<SizeGripImage Height="12px" Url="~/App_Themes/BlackGlass/Web/pcSizeGrip.gif" Width="12px" />
		<HeaderStyle BackColor="#dd0000" ForeColor="white" Font-Bold="true" Font-Size="10pt">
			<Paddings PaddingBottom="6px" PaddingLeft="15px" PaddingRight="6px" PaddingTop="3px" />
		</HeaderStyle>
		<CloseButtonImage Url="~/App_Themes/BlackGlass/web/pcItemCloseButton.gif" />
		<Controls>
			<div style="text-align:center;">
				<span class="text3b">This item has been added to your list.</span><br /><br />
				<asp:button ID="btnContinue" Width="150px" CssClass="buttonSkinL L" runat="server" text="Continue Shopping" OnClientClick="popPurchaseItem.Hide(); return false;" />
				&nbsp;<asp:button ID="btnCheckout" Width="150px" CssClass="buttonSkinL L" runat="server" text="Complete Transaction" OnClientClick="window.location.href='cart.aspx'; return false;" />
			</div>
		</Controls>
	</dxpc:ASPxPopupControl>
	<script language="javascript" type="text/javascript">
		DragInit();
	</script>
	<%--<img id="imgItem" src="~/images/1x1.gif" style="display:none;" runat="server" alt="" />--%>
	<%--<script type="text/javascript" src="zoom/swfobject.js"></script>--%>
	<script type="text/javascript">
	var zoomFactor = -3;
	var imgHeight = 0;
	var imgWidth = 0;
	var displayImg = document.getElementById("<%= imgItem.ClientID %>");
	function zoomImg(val)
	{
		if(val == -1) //zoom out
		{
			zoomFactor--;
		}
		else if(val == 1)
		{
			zoomFactor++;
		}
		displayImg.style.top = 0;
		displayImg.style.left = 0;
		switch(zoomFactor)
		{
			case -3:
				tempHeight = parseInt(imgHeight/4);
				tempWidth = imgWidth / (imgHeight / tempHeight);
 
				displayImg.height = parseInt(tempHeight);
				displayImg.width = parseInt(tempWidth);
				break;
			case -2:
				tempHeight = parseInt(imgHeight/3);
				tempWidth = imgWidth / (imgHeight / tempHeight);
 
				displayImg.height = parseInt(tempHeight);
				displayImg.width = parseInt(tempWidth);
				break;
			case -1:
				tempHeight = parseInt(imgHeight/2);
				tempWidth = imgWidth / (imgHeight / tempHeight);
 
				displayImg.height = parseInt(tempHeight);
				displayImg.width = parseInt(tempWidth);
				break;
			case 0:
				tempHeight = imgHeight;
				tempWidth = imgWidth;
 
				displayImg.height = parseInt(tempHeight);
				displayImg.width = parseInt(tempWidth);
				break;
			default:
				if(zoomFactor > 0)
				{
					alert("You cannot zoom in anymore");
					zoomFactor = 0;
					tempHeight = imgHeight;
					tempWidth = imgWidth;
 
					displayImg.height = parseInt(tempHeight);
					displayImg.width = parseInt(tempWidth);
				}
				else
				{
					alert("You cannot zoom out anymore");
					zoomFactor = -3;
					tempHeight = parseInt(imgHeight/4);
					tempWidth = imgWidth / (imgHeight / tempHeight);
 
					displayImg.height = parseInt(tempHeight);
					displayImg.width = parseInt(tempWidth);
				}
				
				break;
		}
	}
//	function DisplayImage(src,h,w)
//	{
//		var swf = new SWFObject("zoom/megazoom.swf", "megazoom", w, h, "7.0.22", "#FFFFFF", true)
//		swf.addParam("base", "zoom/");
//		swf.addParam("scale", "noscale");
//		swf.addParam("salign", "lt");
//		swf.addParam("wmode", "transparent");
//		swf.addVariable("contentWidth", w)
//		swf.addVariable("contentHeight", h)
//		swf.addVariable("imageUrl", src);
//		swf.addVariable("imageButton","false");
//		swf.addVariable("zoomMax", "150");
//		swf.addVariable("zoomStep","10");
//		swf.addVariable("zoomStart","0");
//		//swf.addVariable("watermarkUrl","zoom/img/watermark.swf");
//		swf.addVariable("navigator","true");
//		swf.addVariable("navigatorSize","75");
//		swf.addVariable("navigatorMode","3");
//		swf.write("imgZoom")
//	}
 
	function DisplayImage(src)
	{
		displayImg.style.display = "none";
		displayImg.src = src;
		displayImg.style.top = 0;
		displayImg.style.left = 0;
		zoomImg(0);
		displayImg.style.display = "";		
	}
	//called by clicking a thumbnail
	function LoadImage(src)
	{
		DisplayImage(src);
		GetImage();
	}
	function GetImage()
	{
		imgFile = displayImg.src.substring(displayImg.src.lastIndexOf("/") + 1,displayImg.src.length);
		getHttpRequest("getImage.aspx?img=" + imgFile,"GetImageResult",false,null);
	}
	function GetImageResult()
	{
		retVal = oHttpRequest.responseText.trim();
		
		if(retVal != "0" && retVal.indexOf("error") == -1)
		{
			imgArray = retVal.split("|");
			
			img = imgArray[0];
			h = imgArray[1];
			w = imgArray[2];
			imgHeight = imgArray[3];
			imgWidth = imgArray[4];
			DisplayImage(img);
			
		}
	
	}
	GetImage();
	if(navigator.userAgent.toLowerCase().indexOf("firefox") != -1){
		document.getElementById("imgContent").style.overflow = "auto";
	}
	</script>
</asp:Content>

Open in new window

0
Comment
Question by:Sandra_joy
  • 4
  • 3
  • 3
10 Comments
 
LVL 7

Expert Comment

by:moseack
ID: 22913691
If I understand correctly and you want the new window to open for the Thumbnails at the bottom, then the code you're looking for is not is this file, but rather in ItemDetails.aspx.cs (this is called the code-behind, and it hold that parts that make the page dynamic).
In this code file there is a function that fills the div called "divAdditionalImages" with the additional image thumbnails.
0
 

Author Comment

by:Sandra_joy
ID: 22913988
I will post this page now:   itemDetails.aspx.cs  below
I want a link to open for the current thumbnail picture in a new window on top of the old window. Or even better the current thumbnail full screen size with the others under it in the new window.
I want this link to be to the right of   "Click + or - to zoom. Click and drag the image to view detail" (AT THE BOTTOM OF THE ZOOM FUNCTION BOX).  The link should say:  FULL SCREEN IMAGE
Actually I want to take out "Click and"  Just leave "Drag the image to view detail" then there will be enough room for "FULL SCREEN IMAGE"
I would like it to be all capitol letters and RED and Underlined, so people will be sure to notice it.  
I check both of these pages and I can't find the wording under the zoom function box in either page.  
I need to know what page and where to put the codes to make this happen.  

using System;
using System.Data;
using System.Data.SqlClient;
using System.Configuration;
using System.Collections;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;
using Microsoft.VisualBasic;
 
public partial class itemDetails : System.Web.UI.Page
{
	string sqlstr = "";
	SqlConnection cn = new SqlConnection(ConfigurationManager.ConnectionStrings["DefaultConnectionString"].ConnectionString);
	SqlCommand cmd = new SqlCommand();
	SqlDataReader dr;
	SevenLogix.Session sessObj = new SevenLogix.Session();
 
	protected void Page_Load(object sender, EventArgs e)
	{
		if (!IsPostBack)
		{
			hdItemID.Value = Request.QueryString["id"];
		}
		if (Request.QueryString["showMsg"] != null)
		{
			Page.Controls.Add(new LiteralControl("<script>popPurchaseItem.Show();</script>"));
		}
 
		if (ConfigurationManager.AppSettings["ECOmmerceEnabled"] == "false")
		{
			divItemButtons.Visible = false;
		}
 
		HtmlContainerControl div = (HtmlContainerControl)this.Page.Master.FindControl("divPageTitle");
		div.InnerHtml = "";
		GetItem();
	}
 
	protected void GetItem()
	{
		try
		{
			sqlstr = "SELECT i.*, img.Image, t.Theme, m.Medium, a.ArtistName "
				+ "FROM Items i "
				+ "LEFT OUTER JOIN ItemImages img ON i.ItemID = img.ItemID AND img.PrimaryImage = 1 "
				+ "LEFT OUTER JOIN Themes t ON i.ThemeID = t.ThemeID "
				+ "LEFT OUTER JOIN Mediums m ON i.MediumID = m.MediumID "
				+ "LEFT OUTER JOIN Artists a ON i.ArtistID = a.ArtistID "
				+ "WHERE i.ItemID = @ItemID";
			cmd.Connection = cn;
			cmd.CommandText = sqlstr;
			cmd.Parameters.Add("@ItemID", SqlDbType.Int).Value = hdItemID.Value;
			cn.Open();
			dr = cmd.ExecuteReader();
 
			dr.Read();
			spnItemTitle.InnerHtml = dr["Title"].ToString();
			spnTitle.InnerHtml = dr["Title"].ToString();
			spnArtist.InnerHtml = "<a href=\"about.aspx?id=" + dr["ArtistID"].ToString() + "\" class=\"navItemDetails\">" + dr["ArtistName"].ToString() + "</a>";
			spnTheme.InnerHtml = dr["Theme"].ToString();
			spnMedium.InnerHtml = dr["Medium"].ToString();
			if (Convert.ToInt32(dr["Width"]) > 0)
			{
				spnSize.InnerHtml += dr["Width"].ToString() + "\" W x ";
			}
			if (Convert.ToInt32(dr["Height"]) > 0)
			{
				spnSize.InnerHtml += dr["Height"].ToString() + "\" H";
			}
			if (Convert.ToInt32(dr["Depth"]) > 0)
			{
				spnSize.InnerHtml += " x " + dr["Depth"].ToString() + "\" D<br>";
			}
			decimal dPrice = Convert.ToDecimal(dr["Price"]);
			spnPrice.InnerHtml = dPrice.ToString("C2");
			
			spnDescription.InnerHtml = dr["Description"].ToString();
			spnDelivery.InnerHtml = dr["Delivery"].ToString();
			spnInspiration.InnerHtml = dr["Inspiration"].ToString();
 
			if (dr["Image"].ToString() != "")
			{
				imgItem.Src = "~/art/" + dr["Image"].ToString();
			}
			dr.Close();
			cmd.Parameters.Clear();
			cn.Close();
 
			//get additional images
			sqlstr = "SELECT ImageID, Image, Thumbnail FROM ItemImages WHERE Active = 1 AND ItemID = @ItemID ORDER BY PrimaryImage DESC";
			cmd.Connection = cn;
			cmd.CommandText = sqlstr;
			cmd.Parameters.Add("@ItemID", SqlDbType.Int).Value = hdItemID.Value;
			cn.Open();
			dr = cmd.ExecuteReader();
 
			while (dr.Read())
			{
				HtmlContainerControl imgDiv = new HtmlGenericControl("div");
				imgDiv.Style.Add("float", "left");
				imgDiv.Style.Add("cursor", "pointer");
				imgDiv.Style.Add("margin", "5px");
 
				HtmlImage img = new HtmlImage();
				img.Src = ConfigurationManager.AppSettings["webroot"] + "/art/" + dr["Thumbnail"].ToString();
				img.Attributes.Add("onclick", "javascript: LoadImage('" + dr["Image"].ToString() + "')");
 
				imgDiv.Controls.Add(img);
 
				divAdditionalImages.Controls.Add(imgDiv);
			}
 
			dr.Close();
			cmd.Parameters.Clear();
			cn.Close();
		}
		catch { }
	}
 
	protected void btnAddItem_Click(object sender, EventArgs e)
	{
		int qty = 1;
		if (Information.IsNumeric(txtQty.Text))
		{
			qty = Convert.ToInt32(txtQty.Text);
		}
 
		if (sessObj.CartID == "" || sessObj.CartID == null)
		{
			sessObj.CartID = Guid.NewGuid().ToString();
		}
 
		//check for existing item
		sqlstr = "SELECT COUNT(*) AS ItemCount FROM CartItems WHERE CartID = @CartID AND ItemID = @ItemID";
		cmd.CommandText = sqlstr;
		cmd.Connection = cn;
		cmd.Parameters.Add("@CartID", SqlDbType.NVarChar).Value = sessObj.CartID;
		cmd.Parameters.Add("@ItemID", SqlDbType.Int).Value = Convert.ToInt32(hdItemID.Value);
		cn.Open();
 
		int itemCount = Convert.ToInt32(cmd.ExecuteScalar());
 
		cn.Close();
		cmd.Parameters.Clear();
 
 
		if (itemCount > 0)//increase itemQty
		{
			sqlstr = "UPDATE CartItems SET Qty = Qty + @Qty WHERE CartID = @CartID AND ItemID = @ItemID";
			cmd.Parameters.Add("@CartID", SqlDbType.NVarChar).Value = sessObj.CartID;
			cmd.Parameters.Add("@ItemID", SqlDbType.Int).Value = Convert.ToInt32(hdItemID.Value);
			cmd.Parameters.Add("@Qty", SqlDbType.Int).Value = Convert.ToInt32(txtQty.Text);
			cmd.Connection = cn;
			cmd.CommandText = sqlstr;
			cn.Open();
 
			cmd.ExecuteNonQuery();
 
			cn.Close();
			cmd.Parameters.Clear();
		}
		else
		{
			sqlstr = "INSERT INTO CartItems (CartID, Qty, ItemID) VALUES ("
				+ "@CartID, @Qty, @ItemID)";
			cmd.Parameters.Add("@CartID", SqlDbType.NVarChar).Value = sessObj.CartID;
			cmd.Parameters.Add("@ItemID", SqlDbType.Int).Value = Convert.ToInt32(hdItemID.Value);
			cmd.Parameters.Add("@Qty", SqlDbType.Int).Value = Convert.ToInt32(txtQty.Text);
			cmd.Connection = cn;
			cmd.CommandText = sqlstr;
			cn.Open();
 
			cmd.ExecuteNonQuery();
 
			cn.Close();
			cmd.Parameters.Clear();
		}
		Response.Redirect("itemDetails.aspx?id=" + hdItemID.Value + "&showMsg=true");
	}
}

Open in new window

0
 
LVL 7

Accepted Solution

by:
moseack earned 500 total points
ID: 22915493
Replace line 29 in ItemDetails.aspx with:
Click <b>+</b> or <b>-</b> to zoom. Drag the image to view detail. <a id="FullScreenAnchor" runat="server" style="color: red;">FULL SCREEN IMAGE</a>
 
Add these two lines to ItemDetails.aspx.cs after line 87:
String ImageUrl = ConfigurationManager.AppSettings["webroot"] + "/art/" + dr["Image"];
FullScreenAnchor.HRef = String.Format("javascript: window.open('{0}','_blank','height=800,width=1200')", ImageUrl);


Explanation:
The changes in ItemDetails.aspx add the <a> tag (link) to the pages, with the wording and style you wanted.
The changes in the .cs file dynamically adds the URL (address) of the image to the aforementioned link within a JavaScript directive to open it in a new window.
0
Get quick recovery of individual SharePoint items

Free tool – Veeam Explorer for Microsoft SharePoint, enables fast, easy restores of SharePoint sites, documents, libraries and lists — all with no agents to manage and no additional licenses to buy.

 

Author Comment

by:Sandra_joy
ID: 22915732
Thanks, I did that ok.  There are problems however. see: http://amariahart.com/itemDetails.aspx?id=10000003  and click on FULL SCREEN IMAGE link.  I am using IE browser but would like it to work in any browser.  
1.  the original page (with thumbnails) now is blank except for:    [object]
2. I want the full screen image to be as large as possible it is restrained to a smaller size than my 22" monitor. I know not everyone has this size but can't it expand to be as big as their monitor allows?
3. I would like the user to be able to EASILY click on each thumbnail to see the full screen image.



*** email removed to protect from spamming ***
ee page editor

0
 
LVL 75

Expert Comment

by:Michel Plungjan
ID: 22916152
For the expert:
an href with
<a href="javascript:window.open(...)">Click</a>
is not optimal
EITHER have something that resolves to this:

<a href="url" target="someTarget" onClick="var w=window.open(this.href,this.target,'height=800,width=1200'); return !w">Click</a>

or if the codebehind cannot do that, it should at least be

String.Format("javascript: void(window.open('{0}','_blank','height=800,width=1200'))", ImageUrl);
0
 
LVL 75

Expert Comment

by:Michel Plungjan
ID: 22919535
Please wrap the window.open(..............) in void()

so
window.open('{0}','_blank','height=800,width=1200')

becomes

void(window.open('{0}','_blank','height=800,width=1200'))

e.g. change

FullScreenAnchor.HRef = String.Format("javascript: window.open('{0}','_blank','height=800,width=1200')", ImageUrl);


to

FullScreenAnchor.HRef = String.Format("javascript: void(window.open('{0}','_blank','height=800,width=1200'))", ImageUrl);


Notice the brackets

If the expert who helped you here would return and change
<a id="FullScreenAnchor" runat="server" style="color: red;">FULL SCREEN IMAGE</a>

to generate
<a href="http://www.amariahart.com/art/a185fe1f-d1a8-4ab5-80aa-d8006a6cd90d_c.jpg" target="_blank"
onClick="var w=window.open(this.href,this.target,'height=800,width=1200'); return !w" style="color: red;">FULL SCREEN IMAGE</a>

then I would be more happy
0
 
LVL 7

Expert Comment

by:moseack
ID: 22919601
Thanks mplungjan,

I'm currently working on resolving the other two requests.
0
 
LVL 75

Expert Comment

by:Michel Plungjan
ID: 22919636
Great

The
return !w
might more clearly be written

return (w)?false:true

It will allow the href to be followed if the visitor has blocked popups
0
 

Author Comment

by:Sandra_joy
ID: 22920292
Ok, I did the void part and I no longer have [object] on a blank page.
I don't know where to put the return (w)?false:true  part.
0
 
LVL 75

Expert Comment

by:Michel Plungjan
ID: 22922176
I cannot tell you.
I suggest you use the javascript link like you have now and we can live with that

And we wait for moseack to come back to tell us how to make a hyperlink in aspx with a proper onClick handler
0

Featured Post

Keep up with what's happening at Experts Exchange!

Sign up to receive Decoded, a new monthly digest with product updates, feature release info, continuing education opportunities, and more.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

This article shows how to deploy dynamic backgrounds to computers depending on the aspect ratio of display
This article discusses how to implement server side field validation and display customized error messages to the client.
The viewer will learn how to dynamically set the form action using jQuery.
Video by: Mark
This lesson goes over how to construct ordered and unordered lists and how to create hyperlinks.
Suggested Courses
Course of the Month20 days, 11 hours left to enroll

865 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question