Tycoon Talk
Become a Big fish!
The number 1 forum for online business!
Post topics, ask questions, share your knowledge.
Tycoon Talk is part of Freelancer.com - find skilled workers online at a fraction of the cost.

JavaScript Forum


You are currently viewing our JavaScript Forum as a guest. Please register to participate.
Login



Reply
picture loading not working
Old 11-16-2005, 01:49 AM picture loading not working
Nahele's Avatar
Extreme Talker

Posts: 204
Trades: 1
So I am trying to open a new window and then set the <img> tag in that window to a new source...this will later be changed to whatever the source is of the image that was clicked, but just trying to get it to work with a static image right now...here's what I have.

HTML Code:
<script language="JavaScript">
function open_picture_viewer () {
	var picture_window = window.open('../pictureviewer.htm', 'picture_window');
	picture_window.document.picture.src = '/Images/charweb_poster.jpg'; 
	return false;
}
</script>
calling with...

HTML Code:
<a href="#" onClick="open_picture_viewer(); return false;">
<img border="0" name="mainpic" height="300" src="#"></a>
and pictureviewer.htm just contains...

HTML Code:
<html>
<head>
<title>Untitled Document</title>
</head>

<body>
<img name="picture" src="#">
</body>
</html>
It will open up the new window but does not change the picture...I did however get it to work if I opened the page in the <head> area and then just had the coding to change the picture with the onclick function, but obviously I don't want this extra window hanging out in the background.
Nahele is offline
Reply With Quote
View Public Profile
 
 
Register now for full access!
Old 11-16-2005, 02:39 AM
Nahele's Avatar
Extreme Talker

Posts: 204
Trades: 1
Never mind, I figured something out to do...though I'm still not sure why it didn't work in the first place.

I changed the open_picture_viewer function to just open the new window but as a blank url, then call another function. This function would writenln each line to the new window. I guess it's not to bad since I only have a few lines of html to write, but a reason why my original way did not work for future purposes would be nice.
Nahele is offline
Reply With Quote
View Public Profile
 
Old 11-16-2005, 01:03 PM
Ultra Talker

Posts: 251
Location: Belgium, Antwerp, Zoersel
Trades: 0
I don't know why it didn't work, but I do know a similar way to do it. use GetElementByName('picture') instead:

HTML Code:
<script language="JavaScript">
function open_picture_viewer () {
  var picture_window = window.open('../pictureviewer.htm', 'picture_window');
  picture_window.document.GetElementByName('picture').src = '/Images/charweb_poster.jpg';
  return false;
}
</script>
__________________

Please login or register to view this content. Registration is FREE
|
Please login or register to view this content. Registration is FREE
|
Please login or register to view this content. Registration is FREE
Orodreth is offline
Reply With Quote
View Public Profile Visit Orodreth's homepage!
 
Reply     « Reply to picture loading not working
 

Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are Off
Pingbacks are Off
Refbacks are Off





   
RSS Feed  Feeds: RSS   JS   XML
RSS Feed  Feeds for this forum: RSS   JS   XML



Page generated in 0.11962 seconds with 12 queries