Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations IamaSherpa on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Inserting Hyperlinks on a Marquee

Status
Not open for further replies.

mattpearcey

Technical User
Mar 7, 2001
302
GB
I have seen various sites where there is moving or scrolling text, that works like a marquee, with the text acting as hyperlinks to the various topics it contains. I want to have a marquee running on my site, that contains news stories that wehn i click on each off them individually, it will open a new page, and link to that story or the site where it was found. Can someone enlighten me as to how this is done?

I have tried going to the marquee feature, but it looks like there is no way i can highlight each sentence and put a different hyperlink on each.

Help and advice needed - thanks? Thank you for your help already.

Matt Pearcey
 
You can add links into the HTML and use any words you like for links. If you copy and paste the following code you will see the words "first website" and "second website" are used as links. You can insert the hyperlinks anywhere you like within the marquee tag.


<Marquee>Link to the <A Href=&quot; first website </A>here or you can choose the <A Href=&quot; website</A></Marquee>

Hope this helps.
 
And the Marquee does not scroll in Netscape. Here is a javascript replacement that is suppose to be cross browser compatible. I have had some issues in regards to background color with it. It is from Dynamic Drive, I am sure if you check there, there would be an updated version:

Code:
//Insert in <HEAD></HEAD> ***This is a two Parter all here*****



<style>
	<!--
	.TextScrollStyle {
		visibility:visible;
		font-size:13pt;
		font-family:Verdana;
		font-weight:bold;
		padding-top:0;
	}
	-->
</style>
<script LANGUAGE=&quot;JavaScript1.2&quot;>

/*
Dynamic Fader Script
Created and submitted by Nicholas Poh (hwinmain@yahoo.com)
Permission granted to Dynamicdrive.com to feature script in archive
For full source code and installation instructions to this script, visit [URL unfurl="true"]http://dynamicdrive.com[/URL]
*/

	var hexbase= new Array(&quot;0&quot;, &quot;1&quot;, &quot;2&quot;, &quot;3&quot;, &quot;4&quot;, &quot;5&quot;, &quot;6&quot;, &quot;7&quot;, &quot;8&quot;, &quot;9&quot;, &quot;A&quot;, &quot;B&quot;, &quot;C&quot;, &quot;D&quot;, &quot;E&quot;, &quot;F&quot;);
	var value=0;
	var Dec2Hex=new Array();
	for (x=0; x<16; x++){
		for (y=0; y<16; y++){
			Dec2Hex[value]= hexbase[x] + hexbase[y];
			value++;
		}
	}

	function RGB2STR(rgbcolor)
	{
		return Dec2Hex[rgbcolor>>16] + Dec2Hex[(rgbcolor>>8)&0xFF] + Dec2Hex[rgbcolor&0xFF];
	}
	

/////Congifure following variables to customize fader//

      var scrollerwidth=200
      var scrollerheight=90
	var TS_colorFG = 0x0000FF;	// Text color
	var TS_colorBG = 0xFFFFFF;	// Background color
	var TS_ymax    = 50;		// Total animation frame
	var TS_ystep   = 1;			// 1 or -1 only
	var TS_speed   = 2;
	
	var TS_message = new Array();
	// Put messages here
	TS_message[0] = 'Hello there';
	TS_message[1] = 'Wow... hope you like it!';
	TS_message[2] = '<A HREF=&quot;[URL unfurl="true"]http://dynamicdrive.com&quot;>dynamicdrive.com</A>';[/URL]

/////End configuration//////////////////

	var TS_ypos    = 0;
	var TS_yposOrg = 0;
	var TS_color   = TS_colorBG;
	var TS_curMsg  = 0;
	
	// Calculate the difference between background and foreground color
	var dfRed   = -((TS_colorBG>>16) - (TS_colorFG>>16)) / (TS_ymax>>1);
	var dfGreen = -(((TS_colorBG>>8)&0xFF) - ((TS_colorFG>>8)&0xFF)) / (TS_ymax>>1);
	var dfBlue  = -((TS_colorBG&0xFF) - (TS_colorFG&0xFF)) / (TS_ymax>>1);
	var TS_opColor  = (dfRed<<16) + (dfGreen<<8) + (dfBlue);
	
	var timer;
	
	function UnloadMe()
	{
		clearTimeout(timer);
	}
	
	function ScrollText()
	{
		if (document.all) {
			// IE
			TextScroll.style.paddingTop = TS_ypos;
			TextScroll.style.color = TS_color;
		}

		TS_ypos += TS_ystep;
		
		TS_color += TS_opColor;
		if (TS_ypos == (TS_ymax>>1) - TS_ystep) {
			TS_opColor *= -1;
		}

		if (TS_ypos >= TS_ymax-1 || TS_ypos <= 0) {
			TS_color = TS_colorBG;
			TS_opColor *= -1;

			if (TS_ystep > 0) {
				TS_ypos = 0;
			} else {
				TS_ypos = TS_ymax;
			}

			if (++TS_curMsg > TS_message.length-1) {
				TS_curMsg = 0;
			}
			
			// Change text
			if (document.all) {
				// IE
				TextScroll.style.paddingTop = TS_ypos;
				TextScroll.innerHTML=TS_message[TS_curMsg];
			}
		}
		
		// Set timer
		timer = setTimeout('ScrollText()', TS_speed);
	}
	
	function ScrollTextDisplay()
	{
		var navName=navigator.appName;
		var navVer=parseInt(navigator.appVersion)
		
		if (!(navName==&quot;Microsoft Internet Explorer&quot; && navVer>=4)){
			return;
		}
		if (navName==&quot;Microsoft Internet Explorer&quot;) {
			TS_speed = 20 + TS_speed;
		}

		document.write('<SPAN ID=&quot;TextScroll&quot; CLASS=&quot;TextScrollStyle&quot; style=&quot;width:'+scrollerwidth+';height:'+scrollerheight+'&quot;>');
		document.write(TS_message[0]);
		document.write('</SPAN>');

		if (TS_ystep > 0) {
			TS_ypos = 0;
		} else {
			TS_ypos = TS_ymax;
		}

		if (document.all) {
			// IE
			TextScroll.style.backgroundColor = TS_colorBG;
			TextScroll.style.color = TS_color;
		}
		
		window.onload=new Function(&quot;timer = setTimeout('ScrollText()', 1000);&quot;)
		window.onunload=UnloadMe;
	}
</script>




****************Insert in the body where it is to appear**************


<SCRIPT language=&quot;JavaScript1.2&quot;>
if (document.all)
ScrollTextDisplay()
</SCRIPT>
DeZiner
Never be afraid to try something new.
Remember that amateurs built the Ark.
Professionals built the Titanic
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top