Current location: Hot Scripts Forums » General Web Coding » JavaScript » JavaScript inside HTML code


JavaScript inside HTML code

Reply
  #1 (permalink)  
Old 11-30-05, 04:16 AM
Mondler Mondler is offline
New Member
 
Join Date: Nov 2005
Posts: 1
Thanks: 0
Thanked 0 Times in 0 Posts
Question JavaScript inside HTML code

I have a javascript function that generates a relative link to my pages in a Lotus Notes database:

function relativePath() {
pageURL=window.location;
//full path
relPath=pageURL.pathname.toLowerCase( );
nsfPos=relPath.indexOf(".nsf");
relPath=relPath.substring(0, nsfPos+5);
return relPath;

}


This code works fine, but I want to be able to refer to this code inside HTML code on my pages.

<a href= this is where I want to refer to relativePath function +"AllWeb/4F81FF13647753EBC1256E2E00475A6B?OpenDocument">
Products</a>

Can anyone help me with the syntax for this?
Any help would be much appreciated.

Rita
Reply With Quote
  #2 (permalink)  
Old 11-30-05, 08:32 PM
ben.periton ben.periton is offline
Wannabe Coder
 
Join Date: Oct 2004
Posts: 183
Thanks: 0
Thanked 0 Times in 0 Posts
Code:
<script language="javascript" type="text/javascript">
function relativePath() {
	pageURL=window.location;
	//full path
	relPath=pageURL.pathname.toLowerCase( );
	nsfPos=relPath.indexOf(".nsf");
	relPath=relPath.substring(0, nsfPos+5);
	return relPath + 'AllWeb/4F81FF13647753EBC1256E2E00475A6B?OpenDocument';
}
</script>
This code works fine, but I want to be able to refer to this code inside HTML code on my pages.

<a href="#" onclick="document.location.href=relativePath();">
Products</a>
__________________
Ben Periton
http://ben.periton.co.uk
Reply With Quote
Reply

Bookmarks


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
html tutoral thefrtman HTML/XHTML/XML 5 04-27-09 10:25 AM
[SOLVED] html code inside text are xtreme231 HTML/XHTML/XML 15 01-29-09 02:23 AM
Referencing HTML code from a second file msoucy HTML/XHTML/XML 2 07-18-05 12:25 AM
please help me turn the html code to javascript kicon JavaScript 5 12-16-04 08:54 AM
Can anyone help me ? (problem using php variables in html db insert code) chronic_ PHP 2 06-13-04 11:19 AM


All times are GMT -5. The time now is 10:59 PM.
vBulletin® Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.