473,473 Members | 1,805 Online
Bytes | Software Development & Data Engineering Community
Create Post

Home Posts Topics Members FAQ

creating new window

14 New Member
I have 10 thumbnails on a page. My goal is to have a new window appear containing the full size image when the small link is clicked under each respective image. But instead of creating 10 html pages, each with a different full-sized image, I am attempting to have my code just write new windows containing the clicked images.

Expand|Select|Wrap|Line Numbers
  1. var newWindow;
  2.  
  3. function writeToWindow() {
  4. newWindow = window.open("","","status,height=200,width=300");
  5. var newContent = " <html><head><title>IMAGE<\/title><\/head>";
  6. newContent += "<body>";
  7. newContent += "<\/body><\/html>";
  8.  
  9. newWindow.document.write(newContent);
  10. newWindow.document.close();
  11. }
[HTML]<a href="#" value="image1" onclick="writeToWindow();">Enlarge image</a>[/HTML]

What should go between the body tags in my js and what should i place in the <a> tags to make this happen?!?!

Thanks!
Jul 13 '07 #1
2 1602
nomad
664 Recognized Expert Contributor
I have 10 thumbnails on a page. My goal is to have a new window appear containing the full size image when the small link is clicked under each respective image. But instead of creating 10 html pages, each with a different full-sized image, I am attempting to have my code just write new windows containing the clicked images.

Expand|Select|Wrap|Line Numbers
  1. var newWindow;
  2.  
  3. function writeToWindow() {
  4. newWindow = window.open("","","status,height=200,width=300");
  5. var newContent = " <html><head><title>IMAGE<\/title><\/head>";
  6. newContent += "<body>";
  7. newContent += "<\/body><\/html>";
  8.  
  9. newWindow.document.write(newContent);
  10. newWindow.document.close();
  11. }
[HTML]<a href="#" value="image1" onclick="writeToWindow();">Enlarge image</a>[/HTML]

What should go between the body tags in my js and what should i place in the <a> tags to make this happen?!?!

Thanks!
not to sure if you can write a array that can hold your images that might be the way to go.
nomad
Jul 13 '07 #2
acoder
16,027 Recognized Expert Moderator MVP
I have 10 thumbnails on a page. My goal is to have a new window appear containing the full size image when the small link is clicked under each respective image. But instead of creating 10 html pages, each with a different full-sized image, I am attempting to have my code just write new windows containing the clicked images.

Expand|Select|Wrap|Line Numbers
  1. var newWindow;
  2.  
  3. function writeToWindow() {
  4. newWindow = window.open("","","status,height=200,width=300");
  5. var newContent = " <html><head><title>IMAGE<\/title><\/head>";
  6. newContent += "<body>";
  7. newContent += "<\/body><\/html>";
  8.  
  9. newWindow.document.write(newContent);
  10. newWindow.document.close();
  11. }
[HTML]<a href="#" value="image1" onclick="writeToWindow();">Enlarge image</a>[/HTML]

What should go between the body tags in my js and what should i place in the <a> tags to make this happen?!?!

Thanks!
Pass the url to the image as an argument in writeToWindow(). Between the body tags, add something like:
Expand|Select|Wrap|Line Numbers
  1. newContent += "<img src=\""+imgsrc+"\">";
Alternatively, just use the link, set the target to "_BLANK" to open a new window, and just link to the image:
[HTML]<a href="url-to-img.gif" target="_BLANK">Enlarge Image</a>[/HTML]
Jul 16 '07 #3

Sign in to post your reply or Sign up for a free account.

Similar topics

22
by: Tom Moroow | last post by:
Hi, I'm pretty new to javascript and was wondering how you would piece together a variable name and then assign it a value. I want to create a hidden field and assign it a value based on the value...
4
by: Altramagnus | last post by:
I have 30 - 40 type of different window. For each type I need about 20 instances of the window. When I try to create them, I get "Error creating window handle" My guess is there is a maximum...
0
by: Matt Warner | last post by:
Hi guys, A couple of people have already posted questions about similar issues but haven't had any response. Occasionally, sometimes after running the app for a few hours, it bombs out saying...
24
by: jonathon | last post by:
Hi all, I have a web app with a popup window for entering data. I don't want to access the web every time this window is opened, as most of the app is AJAX. But I can't figure out how to open...
6
by: DraguVaso | last post by:
Hi, In my application, on some given actions while debugging in Visual Studio, I suddenly get a "System.ComponentModel.Win32Exception was unhandled" Message="Error creating window handle."...
8
by: David W. Simmonds | last post by:
Is there an easy way to create a new browser window from C# and ASP.NET? I would just like to have a popup window without any menus or toolbars that would contain a high-res image. The low-res...
9
by: kermit | last post by:
I keep seeing that you can use the FileSystemObject in either VB script, or Javascript on an aspx page. I added a refrence to the scrrun.dll I added importing namespaces for 'System.Object',...
0
by: Steve | last post by:
Some end users are getting the following message after being in the application for quite some time. Exception Type: System.ComponentModel.Win32Exception NativeErrorCode: 14 ErrorCode:...
11
by: rayala | last post by:
Hi all, I am having very weird problem in my Outlook I am running my web application from with in Outlook.I found a strange problem that it is creating different sessionId if i open a new...
5
by: John Scott | last post by:
Ok..this a rather odd question/problem. I haven't really found a straight forward answer to how to handle this scenario, so I hope someone here can help. Here it is: I have an application...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
1
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
1
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...
0
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The...
0
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
0
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.