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 wOOdy-Soft on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

onClick to URL within TD tag

Status
Not open for further replies.

HigleyLH

Technical User
Oct 7, 2003
12
US
I thought this was going to be fairly simple but I can't seem to make it work. I have a table cell that I want to make the entire region clickable to a URL. I can get it to load the URL in a new window but cannot get it to load in the SAME window. Any ideas? Here's what I've got.

Code:
<SCRIPT language="JavaScript" type="text/JavaScript">
<!-- name = 'mainwindow'; //-->
function loadurl(url) {
        open(url, "mainwindow");
        }
</SCRIPT>

and in the body...

Code:
<TABLE WIDTH=\"100%\">
<TR>
<TD CLASS="smbutton_normal" WIDTH="50%" onClick="loadurl('[URL unfurl="true"]http://www.domain.com')">OPTION</TD>[/URL]
<TD CLASS="smbutton_normal" WIDTH="50%" onClick="loadurl('[URL unfurl="true"]http://www.domain2.com')">OPTION2</TD>[/URL]
</TR>
</TABLE>

Thanks!
Lowell
 
For
Code:
open(url, "mainwindow");
if no existing window is named "mainwindow", open() will create a new browser window to load url; if a window called "mainwindow" exists, url will be loaded in this window.

A method is that set the name of the parent window as "mainwindow"
Code:
[b]windows.name="mainwindow";[/b]
open(url, "mainwindow");
 
sorry for the typing mistake
Code:
[b]window.name="mainwindow";[/b]
open(url, "mainwindow");
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top