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!

Redirecting to dynamically defined hyperlink in Netscape

Status
Not open for further replies.

peeved

Technical User
Aug 10, 2003
1
AU
All I'm trying to do is use a hypertext link built from a variable (see attached code)

It works in internet explorer, but not Netscape?

Anybody know how this can be achieved in Netscape?

Thanks!

------------------------------------------------------------------------------------

<HTML>
<HEAD>
<META NAME=&quot;GENERATOR&quot; Content=&quot;Microsoft Visual Studio 6.0&quot;>
<TITLE></TITLE>
<SCRIPT LANGUAGE=&quot;JavaScript&quot; TYPE=&quot;text/JavaScript&quot;>
function selectChange()
{
// alert('i am a load');
ARTIST_SEARCH='// alert(ARTIST_SEARCH);
}

//--->

</SCRIPT>
</HEAD>
<BODY onLoad=&quot;selectChange()&quot;>
<a href=&quot;artist.search&quot; ID=ARTIST_SEARCH>click here<BR>
</BODY>
</HTML>
 
I know this isn't exactly what you asked for but it does work in both NN and IE. I know there is a way to transfer variables to HTML using some combo like {%var%} or something but I can't remember what that is and the doc I had that referenced this is gone.

Code:
<html>
<body>
 Here is some stuff<br>
 <script language=&quot;javascript&quot;>
  var arrLinks=new Array(&quot;[URL unfurl="true"]http://www.microsoft.com&quot;,&quot;http://www.netscape.com&quot;);[/URL]
  var arrNames=new Array(&quot;Visit Microsoft&quot;,&quot;Visit Netscape&quot;);
  
  for (var i in arrLinks){
   document.write(&quot;<a href=&quot; + arrLinks[i] + &quot;>&quot; + arrNames[i] + &quot;</a><br>&quot;);
  }
 </script> 
 Here is some more stuff
</body>
</html>

Hope this helps, [sig]<p>Rob<br><a href=mailto:robschultz@yahoo.com>robschultz@yahoo.com</a><br>~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~<br>
"Focus on the solution to the problem,<br>
not the obstacles in the way."<br>
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~[/sig]
 
Another solution:
Code:
<script>
 var arrLinks=new Array(&quot;[URL unfurl="true"]http://www.microsoft.com&quot;,&quot;http://www.netscape.com&quot;);[/URL]
 var curLink=1;
</script> 
... some actions can change curLink.
<a href=&quot;[URL unfurl="true"]http://www.opera.com/&quot;[/URL] onclick=&quot;this.href=arrLinks[curLink]; return true;&quot;>...
[sig]<p>Michael Dubner<br>Brainbench MVP/HTML+JavaScript<br>
[/sig]
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top