Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

embedding javascript in HTML

Status
Not open for further replies.

cm80

Technical User
May 3, 2001
85
0
0
US
Hi,
I have an page that at the moment contains mostly HTML. I have a link to a new page using <a href=....>etc.
and I want to use javascripts window.open to open the page in a new window. The only problem is I don't know how to embed the javascript in HTML.
Any help would be appreciated.
 
This is rough, I don't have time to look up the exact syntax, but what you do is:

Write a jscript function which does what you want. Use the appropriate comment markers to indicate that this is embedded javascript so that browsers without jscript won't display parts of your function or otherwise do things you don't want. Then you replace your href with something like &quot;onClick=myfunction(&quot;url&quot;)&quot;.

Check out htmlgoodies.com for a pretty good Javascript tutorial.

Rose
 
Code:
<a href=&quot;javascript:;&quot; onClick=&quot;window.open('about.asp','FILE','width=660,height=500,scrollbars=yes,resizable,toolbar,location')&quot; >Click Here</a>

 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top