Current location: Hot Scripts Forums » General Web Coding » JavaScript » Image display


Image display

Reply
  #1 (permalink)  
Old 04-10-11, 05:48 PM
Frz Frz is offline
New Member
 
Join Date: Apr 2011
Posts: 2
Thanks: 0
Thanked 0 Times in 0 Posts
Image display

How can you display an image on your website that resides on another website? The .gif that I want to display changes every day. I have code that can get the proper filename path, but nothing shows up. I've done this before but for some odd reason it no longer works.

Code:
<script type="text/javascript">

var mydate= new Date()
var theyear=mydate.getFullYear()
var themonth=mydate.getMonth()+1
var thetoday=mydate.getDate()
var now=theyear+"-"+themonth+"-"+thetoday
var showpic="http://www.otherwebsite.com/daily/"+now+".gif"

document.write('<img src="showpic">'); 

<-- (I've tried this and it doesn't work either) document.write('<a href="'showpic'"><img src="'showpic'" border=0></a>') -->
</script>
Reply With Quote
  #2 (permalink)  
Old 04-12-11, 03:12 AM
Frz Frz is offline
New Member
 
Join Date: Apr 2011
Posts: 2
Thanks: 0
Thanked 0 Times in 0 Posts
Solved

Ok, I solved this one. Just in case ya'll want to know....
Code:
document.write('<img src="http://www.otherwebsite.com/daily/' + now + '.gif" border="0" />');
For some odd reason it doesn't like the http part as a variable.
Reply With Quote
  #3 (permalink)  
Old 04-12-11, 03:19 AM
Nico's Avatar
Nico Nico is offline
Community Leader
 
Join Date: Sep 2005
Location: Spain
Posts: 8,075
Thanks: 11
Thanked 88 Times in 83 Posts
This should have worked too.

Code:
document.write('<img src="' + showpic + '">');
Reply With Quote
Reply

Bookmarks

Tags
image


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes

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 Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
output image path from database and display it in page as image. shemi PHP 4 10-05-09 01:44 AM
PHP & MYSQL Same Table Ishmell PHP 7 06-28-09 11:36 PM
div css theighost CSS 11 09-14-08 02:30 AM
Image display based on URL rjwebgraphix PHP 5 09-09-04 08:02 AM


All times are GMT -5. The time now is 02:04 AM.
vBulletin® Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.