Dynadot Aftermarket: discover domain gems worth investing in. Visit our aftermarket.

Javascript novice with small problem...

Namecheap AuctionsNamecheap Auctions
SpaceshipSpaceship
SpaceshipSpaceship
Watch

martyn187

Established Member
Impact
0
I am using javascript for a radio station that displays something different at different hours of the day.... For example:

case 0 :show="Midnight - 1am";break;
case 1 :show="1am - 2am";break;
case 2 :show="2am - 3am";break;

This is all working fine and is displayed using document.write :

document.write("<font size=2><B>"+ show +"</B></font><br>")

It shows the text ok and that is fine. I am trying to get this to be a hyperlink though, I have done it before but am completely stuck with doing it again! I know that you need to have the .html in the document.write and then the ../pagename in the case section. If i do it like this:

document.write(""+ show +".html") then it displays the text ../pagename.html, HOWEVER if I do this:

document.write("<a href="+ show +".html") Then nothing displays. The code is all correct to display just as text, but I cannot for the life of me remember how I got it to link.

If anyone can shed any light on it I would be eternally grateful. The code on this post may not be perfected but in theory it works fine.

All the best,

Martyn

Apologies BTW for the re-post this is more info on my javascript plea post :)
 
0
Close
The views expressed on this page by users and staff are their own, not those of NamePros.
GoDaddyGoDaddy
Re: Javascript novice with small problem...

Originally posted by martyn187
HOWEVER if I do this:

document.write("<a href="+ show +".html") Then nothing displays. The code is all correct to display just as text, but I cannot for the life of me remember how I got it to link.

If anyone can shed any light on it I would be eternally grateful. The code on this post may not be perfected but in theory it works fine.

All the best,

Martyn

Apologies BTW for the re-post this is more info on my javascript plea post :)

Maybe you forgot the end >CLICK</a> part ?

I think something like this should work.
Code:
document.write("<a href="+ show +".html>CLICK</a>");
 
0
Close
Thanks, it works fine now, I can act so dumb!
 
0
Close
Appraise.net

We're social

Escrow.com
Spaceship
Domain Recover
CryptoExchange.com

NamePros updates

Switch between accounts
You can now stay logged in to more than one NamePros account in the same browser. Click your avatar, then "Accounts in this browser", to...
AIVikings
Catchy
  • The sidebar remains visible by scrolling at a speed relative to the page’s height.
Back