Page 1 of 2

popup window

Posted: Tue Apr 20, 2004 5:07 pm
by nikko50
Hi there. Still can't get this Javascript popup to work. No Window pops up and when I hover over the link it shows the wrong url. Please help

print "<tr>
<td width=9%>$line[date]</td>
<td width=20%>$line[recipient]</td>
<td width=30%>$getline[equipment]</td>
<td width=5%>$line[quantity]</td>
<td width=5%>$line[status]</td>

<font color=#0033CC><td width=4%><a href= updateloan.php?rowid=$line[id]><font color='#0000FF'>Edit</font> </a></td></font>
<td width=5%><a href=\"#\" onClick=\"window.open('viewloan.php?rowid=" . $line[id] . "', 'View Loan',
'width=370,height=240,status=1'); return false;\"><font color='#0000FF'>View</font> </a></td>
</tr>
</table>";}

Posted: Tue Apr 20, 2004 5:17 pm
by tim
why make it cleanner by adding the JS to a function, ie:

Code: Select all

function openwin() {
  window.open("page.html", "title", "toolbar=0,status=0,menubar=0,scrollbars=no,resizable=no,width=315,height=400");
}


<a href="javascript:openwin()"> Click me</a>

Posted: Tue Apr 20, 2004 5:18 pm
by feyd
works for me. Although you may want to change

Code: Select all

=" . $line&#1111;id] . "
to

Code: Select all

".$line&#1111;'id']."
you'll get a php notice to the effect of

Code: Select all

"id not found, assuming 'id'"
I'd generally agree with tim here, that a function is a better direction to go for simplicity anyway.

Posted: Tue Apr 20, 2004 5:19 pm
by tim
oh I didnt see u had a var..

I think feyd corrected your code anyway.

if not, let us know

Posted: Tue Apr 20, 2004 5:19 pm
by nikko50
I could do that but I starting doing it this way it now it's got me so frustrated that I won't give up until I see why it does'nt work. Any suggestions on why that statement does not work???
Sharon

Posted: Tue Apr 20, 2004 5:21 pm
by feyd
possibility that onClick isn't being recognized. try onclick. Some browsers are case sensitive.

Posted: Tue Apr 20, 2004 5:30 pm
by nikko50
Still not working guys!:) When I hover over the link it shows website.com/loanreport.php# and no window pops up. It should be website.com/viewloan.php?id=#. It should loop and get each row id number. I can use a function but now it's to the mpoint where i won't give up.

print "<tr>
<td width=9%>$line[date]</td>
<td width=20%>$line[recipient]</td>
<td width=30%>$getline[equipment]</td>
<td width=5%>$line[quantity]</td>
<td width=5%>$line[status]</td>

<font color=#0033CC><td width=4%><a href= updateloan.php?rowid=$line[id]><font color='#0000FF'>Edit</font> </a></td></font>
<td width=5%><a href=\"#\" onclick=\"window.open('viewloan.php?rowid=" . $line['id'] ."', 'View Loan',
'width=370,height=240,status=1'); return false;\"><font color='#0000FF'>View</font> </a></td>
</tr>
</table>";}

Posted: Tue Apr 20, 2004 5:32 pm
by feyd
the hover link is supposed to be website.com/loanreport.php#. Have you tried clicking the link though?

Posted: Tue Apr 20, 2004 5:36 pm
by nikko50
Hi Feyd. The link is called View as you can see from my code but the url should pint to updateloan.php?rowid=$line[id]. I tried to click it but notjing happens.
Sharon

Posted: Tue Apr 20, 2004 5:41 pm
by feyd
well, the code you supplied tries to load viewload.php?rowid=$line[id]

If you are using IE, and the file doesn't exist.. IE will generate a javascript error.

Mozilla (Netscape too, I think) will popup a window, but the content will be a 404 error.

Posted: Tue Apr 20, 2004 5:45 pm
by nikko50
So what your saying it can't be done this way in IE??

Posted: Tue Apr 20, 2004 5:54 pm
by feyd
nonono it works in IE IF the file you are trying to load (viewloan.php) exists.

Posted: Tue Apr 20, 2004 6:00 pm
by nikko50
Hi there. The file does exist but the link does not work for some reason???

Posted: Tue Apr 20, 2004 6:02 pm
by nikko50
Guess what. It works in Mozilla. Now why does it not work in IE??? ow can I fix this??

Posted: Tue Apr 20, 2004 6:18 pm
by magicrobotmonkey
Put this on your page

"This page only works in Mozilla!"