Click to See Complete Forum and Search --> : JavaScript and tabels


Annanas
08-02-2003, 10:09 AM
Hello,
I would like to know why my JavaScript doesn't work inside in a tabel. It works when I put the link in <HEAD> or <BODY>-area, what must I do to make it work inside the table?

---

<html>

<head>
<script src="java.js" language="JavaScript"></script>
<title>Test</title>
</head>

<table border="0">
<tr>
<td width="100%">&nbsp;</td>
</tr>
<tr>
<td width="100%">&nbsp;</td>
</tr>
<tr>
<td width="100%">
<a href="javascript:PopUp ('http://www.google.com');">
Google
</a>
</td>
</tr>
<tr>
<td width="100%">&nbsp;</td>
</tr>
</table>

</html>

---

This is the JavaScript script:

<!-- Ocultando
// Creado con PopUpNow!
// www.PopUpNow.cjb.net
function PopUp(url){
PopUpNow=window.open(url,'PopUpNow','toolbar=no,status=no,menubar=no,location=no,directories=no,resi zable=no,scrollbars=yes,width=140,height=300,left=650,top=100');
}
// Mostrando -->

---

Pleas help me

/Annanas

Khalid Ali
08-02-2003, 11:37 AM
the function below

function PopUp(url){
PopUpNow=window. open(url,'PopUpNow',
'toolbar=no,status=no,menubar=no,location=no,directories=no,resizable=no,scrollbars=yes,width=140,he ight=300,left=650,top=100');
}


works for me...

chrisjmeagher
08-02-2003, 11:54 AM
Hi. In your link tag, try <a href="#" onClick="PopUp('http://www.google.com'); return false;"> instead of what you have there. The pound sign in the HREF part and the return false should make it so that your parent HTML page does not change.

AdamGundry
08-02-2003, 11:56 AM
You shouldn't really be using popups, but if you must, at least use this version of the link:

<a href="http://www.example.com" onClick="PopUp(this.href); return false;">

That way it still works for users with JS disabled.

Adam

Annanas
08-02-2003, 12:24 PM
Thank You! Thank You! Thank You!

:)