TP-Docs
HTML5 Icon HTML5 Icon HTML5 Icon
TP on Social Media

Recent

Welcome to TinyPortal. Please login or sign up.

Members
  • Total Members: 3,963
  • Latest: BiZaJe
Stats
  • Total Posts: 195,913
  • Total Topics: 21,308
  • Online today: 884
  • Online ever: 8,223 (February 19, 2025, 04:35:35 AM)
Users Online
  • Users: 1
  • Guests: 561
  • Total: 562
  • @rjen

A Random Picture/Banner Script

Started by Mitchâ„¢, April 11, 2006, 11:34:21 PM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

Mitchâ„¢


RoarinRow


SMF 2.0 RC3
TP 1.0 beta 5-1
Wordpress 3.0

sdl

#42
You're using single quotes for the URL. Use double quotes. The following code...



<A HREF="http://www.cafepress.com/avstyle/" TARGET="_blank"><img src="http://www.avalanchestyle.com/forum/AVS/Cowgirl_Avatar.jpg"></a>





Will produce:



(note that the target option won't work in this forum, since all URL are redirected automatically to a new window anyway)

RoarinRow

Here's a portion of the code I'm trying to use, including the new code to open the picture to a new page (target="_blank), the double quotes for the URL:

<center>
<SCRIPT LANGUAGE="Javascript">
function banner() {} ; b = new banner() ; n = 0
b[n++]= "<a href="http://www.cafepress.com/avstyle/" target="_blank"><IMG SRC='http://www.avalanchestyle-test.com/forum/GiftShop/MensRinger.jpg' BORDER='0' ALT=''></a>"
b[n++]= "<a href="http://www.cafepress.com/avstyle/" target="_blank"><IMG SRC='http://www.avalanchestyle-test.com/forum/GiftShop/WomansRaglanHoodie.jpg' BORDER='0' ALT=''></a>"
b[n++]= "<a href="http://www.cafepress.com/avstyle/" target="_blank"><IMG SRC='http://www.avalanchestyle-test.com/forum/GiftShop/WomansTracksuit.jpg' BORDER='0' ALT=''></a>"
i=Math.floor(Math.random() * n) ;
document.write( b[i] )
</SCRIPT>
</center>


Somehow it doesn't work, at least when I use the "target="_blank" code. 

SMF 2.0 RC3
TP 1.0 beta 5-1
Wordpress 3.0

copter

#44
try it like thIS it works ;)

Quote<p><center><SCRIPT LANGUAGE="Javascript"><!--
function banner() {} ; b = new banner() ; n = 0
//-----------------------------Database----------------------------
b[n++]= "<A HREF='URL' target='_blank'><IMG SRC='IMAGE URL' BORDER='0' ALT='TOOLTIP'></A>"
//------------------------------------------------------------------
i=Math.floor(Math.random() * n) ;
document.write( b )
//--></SCRIPT></center></p>

Bingo :D

sdl

Yep, that works.  Roarin, remember to close the quotes on target='_blank'


RoarinRow

Quote from: copter on May 03, 2006, 08:49:30 PM
try it like thIS it works ;)

Quote<p><center><SCRIPT LANGUAGE="Javascript"><!--
function banner() {} ; b = new banner() ; n = 0
//-----------------------------Database----------------------------
b[n++]= "<A HREF='URL' target='_blank'><IMG SRC='IMAGE URL' BORDER='0' ALT='TOOLTIP'></A>"
//------------------------------------------------------------------
i=Math.floor(Math.random() * n) ;
document.write( b )
//--></SCRIPT></center></p>

Bingo :D

Yup, this worked thanks all for your support.  Our of curiousity, what does this part do - ALT='TOOLTIP'  previously Mitch's code just had - ALT=''  ?

SMF 2.0 RC3
TP 1.0 beta 5-1
Wordpress 3.0

sdl

When you mouse over the graphic, it shows the Alternate Text in a little box. If someone has graphics disabled, or they are using a text only browser, it shows the Alternate Text instead of an image.


RoarinRow

Quote from: sdl on May 03, 2006, 11:04:00 PM
When you mouse over the graphic, it shows the Alternate Text in a little box. If someone has graphics disabled, or they are using a text only browser, it shows the Alternate Text instead of an image.



So I can actually customize that and replace the word TOOLTIP, with an actual discription of the image.   8)   That would be too professional, I can't stand it.  LOL!

SMF 2.0 RC3
TP 1.0 beta 5-1
Wordpress 3.0

copter

LOL :D

I just highlighted TOOLTIP red, I forgot LOL

This website is proudly hosted on Crocweb Cloud Website Hosting.