| |||||||
| Programming PHP, Perl, Ruby on Rails, AJAX, HTML, XHTML, CSS, JavaScript, MySQL and any other coding topics. |
![]() |
| | LinkBack | Thread Tools |
| | #1 (permalink) |
| New Member | 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 :-) |
| |
| | #2 (permalink) | |
| Senior Member | Re: Javascript novice with small problem... Quote:
I think something like this should work. Code: document.write("<a href="+ show +".html>CLICK</a>");
| |
| |
![]() |
| Currently Active Users Viewing This Thread: 1 (0 members and 1 guests) | |
| Thread Tools | |
| |