Wrox Programmer Forums
Go Back   Wrox Programmer Forums > Web Programming > JavaScript > Javascript How-To
|
Javascript How-To Ask your "How do I do this with Javascript?" questions here.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the Javascript How-To section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old November 28th, 2004, 11:38 PM
Authorized User
 
Join Date: Jul 2004
Posts: 40
Thanks: 0
Thanked 0 Times in 0 Posts
Default sending the src for an image to a new window...

How can I send the name of the src file to a new window that I am opening up....I want to show an enlarged view of an image when clicked - so I just want to send the name of the image file to the new page I am opening up in a new window....any ideas...

 
Old November 29th, 2004, 05:35 AM
joefawcett's Avatar
Wrox Author
 
Join Date: Jun 2003
Posts: 3,074
Thanks: 1
Thanked 38 Times in 37 Posts
Default

You could have an onclick in the image, onclick="showFullImage(this)" for example. The showFullImage function is like:
Code:
function showFullImage(Image)
{
  var sUrl = "<your url goes here";
  sUrl += "?image=" + encodeURIComponent(Image.src);
var oNewWindow = window.open(sUrl, "NewWin", "<feature list here>");
}
If you think ythe browser won't support encodeURIComponent then use the older escape function instead, or try both:
Code:
function encodePath(Data)
{
  if (window.encodeURIComponent)
  {
    return encodeURIComponent(Data);

  }
  return escape(Data);
}

--

Joe (Microsoft MVP - XML)





Similar Threads
Thread Thread Starter Forum Replies Last Post
sending and retrieving image to/from sql mosi C# 2005 1 May 10th, 2008 07:51 AM
chapter 7 js error when changing image src grom BOOK: Beginning Ajax with ASP.NET 1 January 3rd, 2008 12:41 PM
chapter2-src\src\ch02\sample5 _ need help M7777777bill BOOK: Professional Java Development with the Spring Framework 0 June 14th, 2006 10:00 PM
sending src name to new document elladi Classic ASP Basics 3 November 29th, 2004 11:42 PM
Sending key strokes to a window geofff Visual C++ 0 September 9th, 2004 07:19 AM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.