SitePoint Sponsor

User Tag List

Results 1 to 3 of 3
  1. #1
    Non-Member rawkinrich1979's Avatar
    Join Date
    Aug 2003
    Location
    England
    Posts
    85
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Question linking to a html doc using js?

    Is it possible to link to a html doc using a javascript command?

    I don't wish to use any js in the <head> part of the html page, but just using a single javascript statement..

    Something similar to

    Code:
    javascript:top.document.location.href='Link.htm'; onMouseOver=window.status='yellow';
    return true">
    I need to use a code similar to this as I am trying to intergrate it into another script and can't use quotes

    help pls!

  2. #2
    American't awestmoreland's Avatar
    Join Date
    Sep 2002
    Location
    Grand Rapids, MI
    Posts
    1,168
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    You want something like this: DEMO

    Code:
    <html>
      <head>
    	<title>Untitled</title>
    	<style type="text/css">
    	<!--
    	  .linky{
    		text-decoration: underline;
    		cursor: hand;
    		}
    	-->
    	</style>
      </head>
      <body>
    	<a class='linky' onClick="document.location.href='Link.htm';" onMouseOver="window.status='yellow'; return true;" onMouseOut="window.status=''; return true;">link</a>
      </body>
    </html>
    I've seen people use the javascript: prefix on the commands but I'm not sure why that is. Perhaps it's a browser compatibility thing.


    Andy
    From the English nation to a US location.

  3. #3
    Non-Member rawkinrich1979's Avatar
    Join Date
    Aug 2003
    Location
    England
    Posts
    85
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    cheers fella


Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •