Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 7 of 7
  1. #1
    New to the CF scene
    Join Date
    Oct 2010
    Posts
    4
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Unhappy Javascript not working properly in Joomla

    Hello,
    i am a total newbie, so forgive me

    i have the following problem: a Joomla Gallery uses a javascript to show fullsize images.

    but when the popup windows comes out, it doesn't have any properties (page title, url about:blank, blank background etc)

    here is a screenshot:

    I think the following to be the code that calls the popup: what's wrong?

    NOTE I already had to remove some "spaces" from the code because the Joomla SEF was changing the urls forbidding the right execution of everything, maybe it's something like that... dunno :cry:

    Code:
    $htmltext2 .= "<script language=\"JavaScript\">";
    
    	
    
    					$htmltext2 .= "function pgpopup(pgimagefile,pgimagetitle,pgimagedescription) {\n";
    
    					$htmltext2 .= "var newWindow = window.open(\"\",\"newWindow\",\"height=" . ($tabparams["pgmaxheight"]+$dparm[2]) . ",width=" . ($tabparams["pgmaxwidth"]+$dparm[3]) . ",resizable=yes, scrollbars=yes, toolbar=no " . "\" );\n";
    
    					$htmltext2 .= "var imageurl = \"<img src= \"+ pgimagefile + \">\";\n";
    
    					$htmltext2 .= "newWindow.document.open();";
    
    					$htmltext2 .= "newWindow.document.writeln(\"<div align='center' >\");\n";
    
    					$htmltext2 .= "newWindow.document.writeln(\"<title>Profile Gallery Image: \"+ pgimagetitle + \"</title>\");\n";
    
    					$htmltext2 .= "newWindow.document.writeln(imageurl);\n";
    
    					$htmltext2 .= "newWindow.document.writeln(\"<br />\");";
    
    					$htmltext2 .= "newWindow.document.writeln(pgimagedescription);\n";
    
    					$htmltext2 .= "newWindow.document.writeln(\"</div>\");\n";
    
    					$htmltext2 .= "newWindow.document.close();\n";
    
    					$htmltext2 .= "}\n";
    
    					$htmltext2 .= "</script>";
    
    					break;
    anyone can help?

    thanks!

  2. #2
    Senior Coder
    Join Date
    Aug 2010
    Posts
    1,252
    Thanks
    45
    Thanked 276 Times in 274 Posts
    Code:
    $htmltext2 .= "newWindow.document.writeln(\"<div align='center' >\");\n";
    
    					$htmltext2 .= "newWindow.document.writeln(\"<title>Profile Gallery Image: \"+ pgimagetitle + \"</title>\");\n";

    i always thought tittle had to be in head
    not in a div but it works that way for me ?

    $htmltext2 .= "</script>";
    I do it like this
    $htmltext2 .= "</scr"+"ipt>";

    is that javascript ??
    Last edited by DaveyErwin; Oct 12th, 2010 at 09:51 PM.

  3. #3
    New to the CF scene
    Join Date
    Oct 2010
    Posts
    4
    Thanks
    0
    Thanked 0 Times in 0 Posts


    it says:
    Code:
    $htmltext2 .= "<script language=\"JavaScript\">";
    so it should be...

  4. #4
    Supreme Master coder! Old Pedant's Avatar
    Join Date
    Feb 2009
    Posts
    29,698
    Thanks
    93
    Thanked 4,947 Times in 4,908 Posts
    That's not a but and not an error.

    The author did it *INTENTIONALLY* that way.

    You can easily change it.

    Code:
    	$htmltext2 .= "var newWindow = window.open(\"\",\"newWindow\",\"height=" 
                . $tabparams["pgmaxheight"]+$dparm[2]) . ",width=" 
                . ($tabparams["pgmaxwidth"]+$dparm[3]) 
                . ",resizable=yes, scrollbars=yes, toolbar=no " . "\" );\n";
    that is setting the height and width, making the window resizable and scrollable, and removing the toolbar.

    I you want a toolbar, change "toolbar=no" to "toolbar=yes". If you want other window characteristics, just specify them in that code.
    Be yourself. No one else is as qualified.

  5. #5
    Supreme Master coder! Old Pedant's Avatar
    Join Date
    Feb 2009
    Posts
    29,698
    Thanks
    93
    Thanked 4,947 Times in 4,908 Posts
    Quote Originally Posted by DaveyErwin View Post
    i always thought tittle [sic] had to be in head
    not in a div but it works that way for me ?
    In MSIE, yes. But see his Chrome screen shot. It doesn't work there.

    Man that is utterly crap code, isn't it?
    Be yourself. No one else is as qualified.

  6. #6
    New to the CF scene
    Join Date
    Oct 2010
    Posts
    4
    Thanks
    0
    Thanked 0 Times in 0 Posts
    I'm interested in changing background color, font style and color, and windows title...

    how and where have I to put those parameters?

    (soz for my noobiness)

  7. #7
    New to the CF scene
    Join Date
    Oct 2010
    Posts
    4
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Smile

    SOLVED!



    i inserted some html tags.

    the following code is working:

    Code:
    $htmltext2 .= "<script language=\"JavaScript\">";
    
    	
    
    					$htmltext2 .= "function pgpopup(pgimagefile,pgimagetitle,pgimagedescription) {\n";
    
    					$htmltext2 .= "var newWindow = window.open(\"\",\"newWindow\",\"height=" . ($tabparams["pgmaxheight"]+$dparm[2]) . ",width=" . ($tabparams["pgmaxwidth"]+$dparm[3]) . ",resizable=yes, scrollbars=yes, toolbar=no, left=20, top=20 " . "\" );\n";
    
    					$htmltext2 .= "var imageurl = \"<img src= \"+ pgimagefile + \">\";\n";
    
    					$htmltext2 .= "newWindow.document.open();";
    
    					$htmltext2 .= "newWindow.document.writeln(\"<html><head>\");\n";
    
    					$htmltext2 .= "newWindow.document.writeln(\"<title>User image: \"+ pgimagetitle + \"</title>\");\n";
    					
    					$htmltext2 .= "newWindow.document.writeln(\"</head><body bgcolor=#333333><font face='Arial'; size=3; color=#367ec6><div align='center' >\");\n";
    
     					$htmltext2 .= "newWindow.document.writeln(imageurl);\n";
    
    					$htmltext2 .= "newWindow.document.writeln(\"<br />\");";
    
    					$htmltext2 .= "newWindow.document.writeln(pgimagedescription);\n";
    
    					$htmltext2 .= "newWindow.document.writeln(\"</div></body></html>\");\n";
    
    					$htmltext2 .= "newWindow.document.close();\n";
    
    					$htmltext2 .= "}\n";
    
    					$htmltext2 .= "</script>";
    YAHOO!!!


 

Posting Permissions

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