JS\Hyperlink

  • Thread starter Thread starter gh
  • Start date Start date
G

gh

I am using .net v 1.1. I use the code below to dynamically create a
cell with a hyperlink and assign the link information. When I click on
a link the window.open doesn' t fire. What am I missing?

cell.Width = "300";
string aID = ds.Tables[0].Rows[J]["ID"].ToString();
HyperLink aLink = new HyperLink();
aLink.CssClass = "directory";
aLink.ID = "HyperLink"+Convert.ToString(J);
aLink.Text = ds.Tables[0].Rows[J]["CONAME"].ToString();
aLink.NavigateUrl = "javascript:;";
aLink.Attributes.Add("onclick",
"window.open('membercard.aspx?ID="+aID+"','new'," +
"'height=275, width=600, status= no,resizable= no, scrollbars=no,
toolbar=no, menubar=no');");


TIA
 
Please post the HTML produced by your code.
Just load it, then right-click on the page and select View Source. Post the
code for the whole page as this is often caused by an error somewhere else
on the page, such as an unclosed or self-closed <script> tag.
 
Fernando said:
Please post the HTML produced by your code.
Just load it, then right-click on the page and select View Source. Post the
code for the whole page as this is often caused by an error somewhere else
on the page, such as an unclosed or self-closed <script> tag.

gh said:
I am using .net v 1.1. I use the code below to dynamically create a cell
with a hyperlink and assign the link information. When I click on a link
the window.open doesn' t fire. What am I missing?

cell.Width = "300";
string aID = ds.Tables[0].Rows[J]["ID"].ToString();
HyperLink aLink = new HyperLink();
aLink.CssClass = "directory";
aLink.ID = "HyperLink"+Convert.ToString(J);
aLink.Text = ds.Tables[0].Rows[J]["CONAME"].ToString();
aLink.NavigateUrl = "javascript:;";
aLink.Attributes.Add("onclick",
"window.open('membercard.aspx?ID="+aID+"','new'," +
"'height=275, width=600, status= no,resizable= no, scrollbars=no,
toolbar=no, menubar=no');");


TIA


<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="">
<head>
<title>Member Listing</title>
<meta http-equiv="Content-Type" content="text/html;
charset=iso-8859-1">
<meta
content="CFA; Concrete; Foundations; Association; basement;
poured; foundation; precast; poured wall; news; construction; cement;
cracking;"
name="KEYWORDS">
<meta
content="Join us at the Adventurers Club on Disney's Pleasure
Island for 2000 edition of the Concrete Foundations Association annual
winter meeting."
name="DESCRIPTION">
<link href="../images/cfa_style.css" type="text/css" rel="stylesheet">
<style type="text/css">BODY {
BACKGROUND-COLOR: #ebebeb
}
</style>

<script language="JavaScript">
<!--

function SymError()
{
return true;
}

window.onerror = SymError;

function SymInitWinOpen()
{
if (SymRealWinOpen == null)
SymRealWinOpen = window.open;
return SymWinOpen;
}

function SymWinOpen(url, name, attributes)
{
return (new Object());
}

var SymRealWinOpen;
window.open = SymInitWinOpen();

//-->
</script>

<script language="JavaScript">
<!--

function SymError()
{
return true;
}

window.onerror = SymError;

var SymRealWinOpen = window.open;

function SymWinOpen(url, name, attributes)
{
return (new Object());
}

window.open = SymWinOpen;

//-->
</script>
<script language="JavaScript" type="text/JavaScript">
<!--



function MM_reloadPage(init) { //reloads the window if Nav4 resized
if (init==true) with (navigator) {if
((appName=="Netscape")&&(parseInt(appVersion)==4)) {
document.MM_pgW=innerWidth; document.MM_pgH=innerHeight;
onresize=MM_reloadPage; }}
else if (innerWidth!=document.MM_pgW || innerHeight!=document.MM_pgH)
location.reload();
}
MM_reloadPage(true);

function MM_preloadImages() { //v3.0
var d=document; if(d.images){ if(!d.MM_p) d.MM_p=new Array();
var i,j=d.MM_p.length,a=MM_preloadImages.arguments; for(i=0;
i<a.length; i++)
if (a.indexOf("#")!=0){ d.MM_p[j]=new Image; d.MM_p[j++].src=a;}}
}
//-->
</script>
</head>
<body ms_positioning="GridLayout">
<form name="_ctl0" method="post" action="memberlist.aspx?ID=2"
id="_ctl0">
<input type="hidden" name="__VIEWSTATE"
value="dDw1MzM0MTk0MTg7dDw7bDxpPDE+Oz47bDx0PDtsPGk8MT47PjtsPHQ8cDxwPGw8VGV4dDs+O2w8QWxhc2thOz4+Oz47Oz47Pj47Pj47PouHrYlo0R3Z1NLOjAXvg56rtwRK"
/>

<table id="border" cellspacing="0" cellpadding="0" width="740"
align="center"
border="0">
<tbody>
<tr>
<td bgcolor="#999999">
<img height="1" alt="" src="../images/1x1_blank.gif"
width="1"></td>
<td bgcolor="#999999">
<img height="1" alt="" src="../images/1x1_blank.gif"
width="738"></td>
<td bgcolor="#999999">
<img height="1" src="../images/1x1_blank.gif" width="1"></td>
</tr>
<tr>
<td bgcolor="#999999" rowspan="2">
<img height="1" alt="" src="../images/1x1_blank.gif"
width="1"></td>
<td bgcolor="#ffffff">
<a href="../index.htm">
<img height="40" src="../images/logo.gif" width="40"
border="0">
</a>
<img height="40" src="../images/submast.gif"
width="390"></td>
<td bgcolor="#999999" rowspan="2">
<img height="1" alt="" src="../images/1x1_blank.gif"
width="1"></td>
</tr>
<tr>
<td bgcolor="#ffffff">
<table cellspacing="0" cellpadding="0" width="738"
border="0">
<tbody>
<tr>
<td>
<img height="3" alt="" src="../images/1x1_blank.gif"
width="3"></td>
<td>
<img height="5" alt="" src="../images/1x1_blank.gif"
width="1"></td>
<td valign="top">
<img height="3" alt="" src="../images/1x1_blank.gif"
width="3"></td>
</tr>
<tr>
<td valign="top">
<table cellspacing="0" cellpadding="0"
width="185" border="0">
<tbody>
<tr>
<td class="menuSection"
bgcolor="#ffffff">Explore
the CFA </td>
</tr>
<tr>
<td align="center" bgcolor="#ffffff">
<table id="navMenu" cellspacing="0"
cellpadding="0"
width="173"
border="0">
<tbody>
<tr>
<td bgcolor="#ffffff">
<img height="6" alt=""
src="../images/1x1_blank.gif"
width="6"></td>
</tr>
<tr>
<td bgcolor="#ffffff">
<a
href="http://www.cfawalls.org/about/index.htm">About
the CFA </a></td>
</tr>
<tr>
<td bgcolor="#ffffff">
<a
href="http://www.cfawalls.org/foundations/index.htm">About
Foundations </a></td>
</tr>
<tr>
<td bgcolor="#ffffff">
<a
href="http://www.cfawalls.org/cfa_calendar/index.htm">Upcoming
Events </a></td>
</tr>
<tr>
<td bgcolor="#ffffff">
<a
href="http://www.cfawalls.org/products/index.htm">Products
and Services </a></td>
</tr>
<tr>
<td bgcolor="#ffffff">
<a
href="http://www.cfawalls.org/news_press/index.htm">News
and Press </a></td>
</tr>
<tr>
<td bgcolor="#ffffff">
<a
href="http://www.cfawalls.org/awards/index.htm">CFA
Awards </a></td>
</tr>
<tr>
<td bgcolor="#ffffff">
<a
href="http://www.cfawalls.org/chapters/index.htm">Local
Chapters </a></td>
</tr>
<tr>
<td bgcolor="#ffffff">
<a
href="http://www.cfawalls.org/search/index.htm">Site
Search </a></td>
</tr>
<tr>
<td bgcolor="#ffffff">
<a href="../login/index.htm">Member
Login </a></td>
</tr>
</tbody>
</table></td>
</tr>
<tr>
<td>
<img height="12" alt=""
src="../images/1x1_blank.gif"
width="5"></td>
</tr>
<tr>
<td class="menuSection">&nbsp;</td>
</tr>
<tr>
<td align="center">
<table id="navSub" cellspacing="0"
cellpadding="0"
width="173"
border="0">
<tbody>
<tr>
<td>
<img height="6" alt=""
src="../images/1x1_blank.gif"
width="5"></td>
</tr>
<tr>
<td>
<a
href="http://www.cfawalls.org/maintenance.htm"></a></td>
</tr>
<tr>
<td></td>
</tr>
</tbody>
</table></td>
</tr>
<tr>
<td>
<img height="12" alt=""
src="../images/1x1_blank.gif"
width="5"></td>
</tr>
<tr>
<td class="menuSection">Contact
Us </td>
</tr>
<tr>
<td align="center">
<table cellspacing="0" cellpadding="0"
width="173"
border="0">
<tbody>
<tr>
<td>
<img height="6" alt=""
src="../images/1x1_blank.gif"
width="5"></td>
</tr>
<tr>
<td class="menuText">Concrete
Foundation Association
<strong>
<br>
</strong>PO
Box 204
<br>
113 W
First Street
<br>
Mt.
Vernon, Iowa 52314
<br>
<br>
T: (319)
895-6940
<br>
F: (319)
895-8830
<br>
<br>
<a
href="mailto:[email protected]">[email protected]</a></td>
</tr>
<tr>
<td>
<img height="8" alt=""
src="../images/1x1_blank.gif"
width="5"></td>
</tr>
</tbody>
</table></td>
</tr>
<tr>
<td>&nbsp;</td>
</tr>
</tbody>
</table></td>
<td bgcolor="#cccccc">
<img height="1" src="../images/1x1_blank.gif"
width="1"></td>
<td valign="top">
<table cellspacing="0" cellpadding="0"
width="552" border="0">
<tbody>
<tr>
<td>
<table id="breadcrumbs" cellspacing="0"
cellpadding="0"
width="552"
border="0">
<tbody>
<tr>
<td class="breadcrumbs">
<a
href="http://www.cfawalls.org/index.htm">Home</a>
&gt;
<a
href="http://www.cfawalls.org/news_press/index.htm">About
the CFA </a>&gt;
Member Listing</td>
</tr>
</tbody>
</table></td>
</tr>
<tr>
<td>
<table cellspacing="0" cellpadding="0"
width="552"
border="0">
<tbody>
<tr>
<td>
<img height="38"

src="http://cfawalls.org/images/page_findmember.jpg"
width="253"></td>
<td>
<img height="38"
src="../images/page_right.jpg"
width="299"></td>
</tr>
<tr>
<td colspan="2">
<img height="32"
src="../images/page_bottom.jpg"
width="552"></td>
</tr>
</tbody>
</table></td>
</tr>
<tr>
<td class="newsTitle" style="HEIGHT: 6px">
<p align="left">CFA
Member Listing For:</p></td>
</tr>
<tr>
<td class="newsTitle" style="HEIGHT: 2px">
<div align="left">
&nbsp;<span id="lblState">Alaska</span>
</div></td>
</tr>
<tr>
<td>
<table cellspacing="0" cellpadding="0"
width="552"
border="0">
<tbody>
<tr>
<td>
<img style="WIDTH: 402px; HEIGHT:
30px"
height="5"
alt=""
src="../images/1x1_blank.gif"
width="402"></td>
<td>
<img height="5" alt=""
src="../images/1x1_blank.gif"
width="140"></td>
<td>
<img height="5" alt=""
src="../images/1x1_blank.gif"
width="10"></td>
</tr>
<tr valign="top">
<td class="body">
<p>
<table id="tblMembers"
title="Members" bordercolor="silver" cellspacing="1" cellpadding="1"
width="300" align="left" border="1">
<tr>
<td class="c1"></td>
<td>
<img id="image2"
src="../images/Professional.gif" alt="" border="0" /></td>
<td>
<img id="image3"
src="../images/Local-Supplier.gif" alt="" border="0" /></td>
<td>
<img id="Image19"
src="../images/Contractor-600.gif" alt="" border="0" /></td>
<td>
<img id="image4"
src="../images/National-Supplier.gif" alt="" border="0" /></td>
<td class="c1">
<img id="image5"
src="../images/Board-Member.gif" alt="" border="0" /></td>
<td>
<img id="image7"
src="../images/Committee-Member.gif" alt="" border="0" /></td>
<td></td>
</tr>
<tr>
<td id="_aCell0" bordercolor="Silver" nowrap="nowrap" width="300"><a
id="HyperLink0" class="directory"
onclick="window.open('membercard.aspx?ID=15320','new','height=275,
width=600, status= no,resizable= no, scrollbars=no, toolbar=no,
menubar=no');" href="javascript:;">Siegel Constructions LLC</a></td>
<td id="_aCell1" bordercolor="Silver" nowrap="nowrap"><img
src="../images/emptycheckbox.gif" alt="" border="0" /></td>
<td id="_aCell2" bordercolor="Silver" nowrap="nowrap"><img
src="../images/emptycheckbox.gif" alt="" border="0" /></td>
<td id="_aCell3" bordercolor="Silver" nowrap="nowrap"><img
src="../images/checkbox.gif" alt="" border="0" /></td>
<td id="_aCell4" bordercolor="Silver" nowrap="nowrap"><img
src="../images/emptycheckbox.gif" alt="" border="0" /></td>
<td id="_aCell5" bordercolor="Silver" nowrap="nowrap"><img
src="../images/emptycheckbox.gif" alt="" border="0" /></td>
<td id="_aCell6" bordercolor="Silver" nowrap="nowrap"><img
src="../images/emptycheckbox.gif" alt="" border="0" /></td>
</tr>
</table>

</p></td>
<td rowspan="2">&nbsp;</td>
<td rowspan="2">&nbsp;</td>
</tr>
<tr valign="top">
<td class="body">&nbsp;</td>
</tr>
<tr valign="top">
<td class="body" colspan="2"
rowspan="3">&nbsp;</td>
<td>&nbsp;</td>
</tr>
<tr valign="top">
<td>&nbsp;</td>
</tr>
<tr valign="top">
<td>&nbsp;</td>
</tr>
</tbody>
</table></td>
</tr>
<tr>
<td class="body">
<p>
<br>
</p></td>
</tr>
</tbody>
</table></td>
</tr>
<tr bgcolor="#cccccc">
<td colspan="3">
<img height="1" alt="" src="../images/1x1_blank.gif"
width="1"></td>
</tr>
<tr>
<td colspan="3">
<table id="bottomText" cellspacing="0"
cellpadding="0"
width="738" border="0">
<tbody>
<tr>
<td>
<img height="3" alt=""
src="../images/1x1_blank.gif"
width="185"></td>
<td>
<img height="3" alt=""
src="../images/1x1_blank.gif"
width="553"></td>
</tr>
<tr>
<td>
<img height="1" alt=""
src="../images/1x1_blank.gif"
width="8">©
2005 CFA - All Rights Reserved </td>
<td>
<img height="3" alt=""
src="../images/1x1_blank.gif"
width="4">
<a
href="http://www.cfawalls.org/index.htm">Home</a>
|
<a
href="http://www.cfawalls.org/about/index.htm">CFA</a>
|
<a
href="http://www.cfawalls.org/foundations/index.htm">Foundations</a>
|
<a
href="http://www.cfawalls.org/cfa_calendar/index.htm">Events</a>
|
<a
href="http://www.cfawalls.org/products/index.htm">Products
and Services </a>|
<a
href="http://www.cfawalls.org/news_press/index.htm">News</a>
|
<a
href="http://www.cfawalls.org/awards/index.htm">Awards</a>
|
<a
href="http://www.cfawalls.org/chapters/index.htm">Chapters</a>
|
<a
href="http://www.cfawalls.org/search/index.htm">Search</a>
|
<a
href="http://www.cfawalls.org/about/contact_us.htm">Contact</a>
|
<a
href="http://www.cfawalls.org/about/privacy.htm">Privacy</a></td>
</tr>
<tr>
<td>
<img height="3" alt=""
src="../images/1x1_blank.gif"
width="185"></td>
<td>
<img height="3" alt=""
src="../images/1x1_blank.gif"
width="10"></td>
</tr>
</tbody>
</table></td>
</tr>
</tbody>
</table></td>
</tr>
<tr>
<td bgcolor="#999999">
<img height="1" alt="" src="../images/1x1_blank.gif"
width="1"></td>
<td bgcolor="#999999">
<img height="1" alt="" src="../images/1x1_blank.gif"
width="1"></td>
<td bgcolor="#999999">
<img height="1" alt="" src="../images/1x1_blank.gif"
width="1"></td>
</tr>
</tbody>
</table>
</form>
<script language="JavaScript">
<!--
var SymRealOnLoad;
var SymRealOnUnload;

function SymOnUnload()
{
window.open = SymWinOpen;
if(SymRealOnUnload != null)
SymRealOnUnload();
}

function SymOnLoad()
{
if(SymRealOnLoad != null)
SymRealOnLoad();
window.open = SymRealWinOpen;
SymRealOnUnload = window.onunload;
window.onunload = SymOnUnload;
}

SymRealOnLoad = window.onload;
window.onload = SymOnLoad;

//-->
</script>
<!-- Start of StatCounter Code -->
<script type="text/javascript">
var sc_project=3283247;
var sc_invisible=0;
var sc_partition=21;
var sc_security="6397a3db";
</script>

<script type="text/javascript"
src="http://www.statcounter.com/counter/counter_xhtml.js"></script><noscript><div
class="statcounter"><a class="statcounter"
href="http://www.statcounter.com/"><img class="statcounter"
src="http://c22.statcounter.com/3283247/0/6397a3db/0/" alt="website
tracker" /></a></div></noscript>
<!-- End of StatCounter Code -->
</body>
</html>

<script language="JavaScript">
<!--

var SymRealOnLoad;
var SymRealOnUnload;
function SymOnUnload()
{
window.open = SymWinOpen;
if(SymRealOnUnload != null)
SymRealOnUnload();
}

function SymOnLoad()
{
if(SymRealOnLoad != null)
SymRealOnLoad();
window.open = SymRealWinOpen;
if (SymRealOnUnload == null)
{
SymRealOnUnload = window.onunload;
window.onunload = SymOnUnload;
}
}

function SymInitWinOnload()
{
if ( SymRealOnLoad == null )
SymRealOnLoad = window.onload;
return SymOnLoad;
}

window.onload = SymInitWinOnload();

//-->
</script>
 
Back
Top