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. - var newWindow;
-
-
function writeToWindow() {
-
newWindow = window.open("","","status,height=200,width=300");
-
var newContent = " <html><head><title>IMAGE<\/title><\/head>";
-
newContent += "<body>";
-
newContent += "<\/body><\/html>";
-
-
newWindow.document.write(newContent);
-
newWindow.document.close();
-
}
[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!
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. - var newWindow;
-
-
function writeToWindow() {
-
newWindow = window.open("","","status,height=200,width=300");
-
var newContent = " <html><head><title>IMAGE<\/title><\/head>";
-
newContent += "<body>";
-
newContent += "<\/body><\/html>";
-
-
newWindow.document.write(newContent);
-
newWindow.document.close();
-
}
[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
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. - var newWindow;
-
-
function writeToWindow() {
-
newWindow = window.open("","","status,height=200,width=300");
-
var newContent = " <html><head><title>IMAGE<\/title><\/head>";
-
newContent += "<body>";
-
newContent += "<\/body><\/html>";
-
-
newWindow.document.write(newContent);
-
newWindow.document.close();
-
}
[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: - 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]
Sign in to post your reply or Sign up for a free account.
Similar topics |
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...
|
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...
|
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...
|
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...
|
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."...
| |
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...
|
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',...
|
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:...
|
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...
|
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...
|
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,...
| |
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...
|
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...
|
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...
|
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,...
|
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...
|
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...
| |
by: adsilva |
last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
|
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...
| |