airconijn
|
| Posted: 03/28/2002, 1:06 AM |
|
People,
I have a small problem with CodeCharge, Javascript and/or ASP.
Let’s say I have an ASP page with a list of titles of books. What I want to happen is that when I click on a title a pop-up window appears with a summary of the contents of the book. But I do not want the pop-up window to contain the browser’s menubar, toolbar etc.
I know how to do this with static HTML and JavaScript, but it doesn’t seem to work with dynamic ASP. The only thing I manage is to get the data in a new window, but with all the browser’s toolbars .
Can anyone tell me if this is possible and where I have to put what code? I’m using ASP and MS Access.
Thanks in advance
|
|
|
 |
Nicole
|
| Posted: 03/28/2002, 1:38 AM |
|
Hello,
create separate page to display book content. You may use JavaScript to display it in new window. To do it create custom url link and assign JS function for onclick event for it.
Here is sample JS function body that opens new window:
<script language = "JavaScript">
function open_win()
{
var w = open ('', 'windowName', 'width=300,height=300,titlebar=0');
w.document.open();
w.location.href="BookContent.asp?book_id=" + document.form_name.book_id_name.value;
w.document.write('<HTML><BODY>Please wait while page is loading...<br><A HREF="javascript: window.close();">close<\/A>');
w.document.close();
}
</script>
Note, to be able to access field value from JavaScript set its type to e.g. Hidden (or any other updatable type).
|
|
|
 |
airconijn
|
| Posted: 03/28/2002, 6:49 AM |
|
Okay i’ve tried some stuff now, but nothing seems to work over here.
I’ve put the <script………</script> part in the header of the form, and in the Before Show Event of the form I’ve put:
Fldbookid “<a href “booksummary.asp” target=”new” onclick=”open_win(‘booksummary.asp’); return false;”>”&bookid&”</a>
I’ve tried to put in:
Fldbookid “<a href ““booksummary.asp?bookid=”&bookid&””” target=”new” onclick=”open_win(‘booksummary.asp’); return false;”>”&bookid&”</a>”
And all the possible combinations/variations of the two above (I think) but Internet Explorer says he expects the end of a statement (at different positions, depends on the number of quotes I use).
Can anybody tell me where I go wrong?
Thanks again
|
|
|
 |
Nicole
|
| Posted: 03/29/2002, 12:42 AM |
|
Hello,
1. in JS code do not forget to change form and field names to real ones.
2. add Label type field and create custom url link. To do it select 'HTML' flag in field properties and put the code like below to Before Show event of the form:
fldField1 = "<a href=""javascript:open_win()"">open in new window</a>"
|
|
|
 |
airconijn
|
| Posted: 04/02/2002, 1:14 AM |
|
Okay people it works!
I did it slightly different than you suggested, but thanks for the help because I don’t think I would have made it without it.
Here’s my final code:
BEFORE SHOW EVENT:
fldbookid = "<A HREF=""booksummary.asp?bookid="&fldbookid&""" target=""new"" onclick=""NewWindowD()"">"&fldbookid&"</A>"
HEADER SECTION:
<SCRIPT TYPE="text/javascript" LANGUAGE="JavaScript">
<!--
function NewWindowD() {
window.open("", "new", "width=330,height=200");
}
//-->
</SCRIPT>
Regards,
airconijn
|
|
|
 |
feha
|
| Posted: 04/02/2002, 9:09 PM |
|
You have more control if You use this:
<script language="JavaScript">
<!--
function openVision(URL,Name,Width,Height,F) {
var w = (screen.width - Width)/2;
var h = (screen.height - Height)/2 - 10;
F = F+',width='+Width+',height='+Height+',top='+h+',left='+w;
window.open(URL,Name,F);
}
//-->
</script>
call it as:
<a href="javascript:openVision('/yourlink?','more','550','650','toolbar=no,scrollbars=yes,resizable=yes,titlebar=no')" TITLE="POPUP WINDOW!" >
You will get allways centered popup window...!
I'm using it at
www.vision.to/cgi
|
|
|
 |
feha
|
| Posted: 04/02/2002, 9:19 PM |
|
I need a function that reads image size (PHP) so it would be possible to generate/read: $he','$wi' vaiables before image display,that way will show allways the right size of the popup window depending on image size!
<a href="javascript:openVision('/yourlink?','more','$wi','$he','toolbar=no,scrollbars=yes,resizable=yes,titlebar=no')" TITLE="POPUP WINDOW!" >
|
|
|
 |
|