Results 1 to 5 of 5

Thread: JavaScript Window

  1. #1

    Thread Starter
    PowerPoster
    Join Date
    Dec 2003
    Posts
    4,787

    JavaScript Window

    Ok i've built up a gallery for a client and i ahd each thumnail loading up ina seperate window. But he decided he wanted javascript windows.

    Now then I'm a javascript N00b and dont really want tpo get into it but do need some help with this.

    Code:
    <SCRIPT LANGUAGE="JavaScript">
    function show_photo(pFileName,pTitle,pCaption) {
    	photoWin = window.open( "", "Cerys Gallery", "width=600,height=450, status,scrollbars,resizable,screenX=20,screenY=40,left=20,top=40");
    	photoWin.document.write('<html><head><title>' + pTitle + '</title></head>');	
    	photoWin.document.write('<BODY BGCOLOR=#000000 TEXT=#FFFFCC LINK=#33CCFF VLINK=#FF6666>');
    	photoWin.document.write('<center>');
    	photoWin.document.write('<font size=+3 face="arial,helvetica"><b>' + pCaption + '</b></font><br>');
    	photoWin.document.write('<img src="' + pFileName + '"><p>');
    	photoWin.document.write('<font face="arial,helvetica">');	
    	photoWin.document.write('"' + pTitle + '"<br>');
    	photoWin.document.write('<p></font></body></html>');
    	photoWin.document.close();	
    	if (navigator.appName.substring(0,8) == "Netscape") photoWin.focus();
    }
    </SCRIPT>
    and i am trying to set a link of each picture file to load its picture/captiona dn title in this javascript widnow.

    PHP Code:
                 echo "<a href='javascript:show_photo(" $path "," $title "," $caption ")>";
                 echo 
    "<img src='" $path "' width='100'></a></td>"
    As we can see i'm mixing Php/Html/Javascript

    This does nothing can anyone explain to me how to use the function above corrrctly?

  2. #2

    Thread Starter
    PowerPoster
    Join Date
    Dec 2003
    Posts
    4,787

    Re: JavaScript Window

    Anyone any thoughts? I'm stuck here and i have a client on my back

  3. #3
    Ex-Super Mod RobDog888's Avatar
    Join Date
    Apr 2001
    Location
    LA, Calif. Raiders #1 AKA:Gangsta Yoda™
    Posts
    60,709

    Re: JavaScript Window

    You say it does nothing? No popup window?

    This is a snippet of some of my js code for a popup window. Note that the parameters for the popup are in the format - scrollbars=False ....

    Code:
    function openPopWin(winURL, winWidth, winHeight, winScroll) {
        var winOptions = 'menubar=no,toolbar=no,location=no,directories=no,status=yes,scrollbars=' + winScroll + ',resizable=yes,width=' + winWidth + ',height=' + winHeight;
        popup = window.open(winURL, 'popup', winOptions);
    }
    VB/Office Guru™ (AKA: Gangsta Yoda®)
    I dont answer coding questions via PM. Please post a thread in the appropriate forum.

    Microsoft MVP 2006-2011
    Office Development FAQ (C#, VB.NET, VB 6, VBA)
    Senior Jedi Software Engineer MCP (VB 6 & .NET), BSEE, CET
    If a post has helped you then Please Rate it!
    Reps & Rating PostsVS.NET on Vista Multiple .NET Framework Versions Office Primary Interop AssembliesVB/Office Guru™ Word SpellChecker™.NETVB/Office Guru™ Word SpellChecker™ VB6VB.NET Attributes Ex.Outlook Global Address ListAPI Viewer utility.NET API Viewer Utility
    System: Intel i7 6850K, Geforce GTX1060, Samsung M.2 1 TB & SATA 500 GB, 32 GBs DDR4 3300 Quad Channel RAM, 2 Viewsonic 24" LCDs, Windows 10, Office 2016, VS 2019, VB6 SP6

  4. #4
    Ex-Super Mod RobDog888's Avatar
    Join Date
    Apr 2001
    Location
    LA, Calif. Raiders #1 AKA:Gangsta Yoda™
    Posts
    60,709

    Re: JavaScript Window

    Oh ya, and I just noticed that your not using the escape character for your document.write code.
    Code:
    .document.write("<html><head><title>Loading Image, Please Wait...<\/title><\/head><body leftmargin=0 topmargin=0 marginwidth=0 marginheight=0 text='",imgWidth,imgHeight,"'><center><a href='#' onClick =javascript:window.close()><img src='",imgName,"' alt='Click to Close' border='0'><\/a><\/center><\/body><\/html>")
    VB/Office Guru™ (AKA: Gangsta Yoda®)
    I dont answer coding questions via PM. Please post a thread in the appropriate forum.

    Microsoft MVP 2006-2011
    Office Development FAQ (C#, VB.NET, VB 6, VBA)
    Senior Jedi Software Engineer MCP (VB 6 & .NET), BSEE, CET
    If a post has helped you then Please Rate it!
    Reps & Rating PostsVS.NET on Vista Multiple .NET Framework Versions Office Primary Interop AssembliesVB/Office Guru™ Word SpellChecker™.NETVB/Office Guru™ Word SpellChecker™ VB6VB.NET Attributes Ex.Outlook Global Address ListAPI Viewer utility.NET API Viewer Utility
    System: Intel i7 6850K, Geforce GTX1060, Samsung M.2 1 TB & SATA 500 GB, 32 GBs DDR4 3300 Quad Channel RAM, 2 Viewsonic 24" LCDs, Windows 10, Office 2016, VS 2019, VB6 SP6

  5. #5
    Fanatic Member ALL's Avatar
    Join Date
    Jul 2004
    Location
    192.168.1.1
    Posts
    711

    Re: JavaScript Window

    just a little point (if you want it!)... you dont need to seperate the variables form the output, unless you use the single quote. also you can do a line return in an echo statement
    PHP Code:
    echo "<a href='javascript:show_photo(" $path "," $title "," $caption ")>"
                 echo 
    "<img src='" $path "' width='100'></a></td>"
    to:
    PHP Code:
    echo "<a href='javascript:show_photo($path,$title,$caption)'> 
    <img src='
    $path' width='100'></a></td>"
    just thought i'd let you know

    PS: you are missing your end single quote of the first line of that php code! (i added in the second snippit)
    Last edited by ALL; Jun 18th, 2005 at 05:22 PM.
    Please support one of my projects?
    TKForums.com

    Web Forum
    JavaScript Wiki
    ________________________
    If somone helps you, please rate their post, by clicking the to rate their post

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width