-
May 7th, 2012, 10:19 PM
#1
Function to load page
Hello,
I am using the following code:
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:
Code:
<a href="page.html" class="first">Link text</a>
But I want to include class="first" part of the javascript function.
Any ideas?
-
May 10th, 2012, 12:31 PM
#2
Re: Function to load page
Not sure why you would ever need this...
Code:
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
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|