CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums
Results 1 to 2 of 2

Thread: Function to load page

  1. #1
    Join Date
    Mar 2006

    Function to load page


    I am using the following code:

    function test()
    location.href = "home.htm" ;
    I want to use a function to load a page (which above is working) but I want to have a class part of the URL.

    I know I can use a link on the page like:
    <a href="page.html" class="first">Link text</a>
    But I want to include class="first" part of the javascript function.

    Any ideas?

  2. #2
    PeejAvery's Avatar
    PeejAvery is offline Super Moderator Power Poster
    Join Date
    May 2002

    Re: Function to load page

    Not sure why you would ever need this...

    function link(elem, page) {
      var class = elem.class;
      location.href = page;
    <a href="javascript:link(this, 'page.html')" class="first">Link text</a>
    If the post was helpful...Rate it! Remember to use [code] or [php] tags.

Posting Permissions

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

Windows Mobile Development Center

Click Here to Expand Forum to Full Width

On-Demand Webinars (sponsored)