Ravens PHP Scripts: Forums
 

 

View next topic
View previous topic
Post new topic   Reply to topic    Ravens PHP Scripts And Web Hosting Forum Index -> Other - Discussion
Author Message
montego
Site Admin



Joined: Aug 29, 2004
Posts: 9457
Location: Arizona

PostPosted: Tue Jan 24, 2006 8:34 am Reply with quote

Ok, this is driving me crazy. I am working on a project where I have a need to open a new window and pass to it the URL to use. I wanted to be W3C strict compliant, so no "target=" attributes are allowed. Therefore, I am trying to use j avascripts window.open command. If I call my open window function from a link anchor tag it works just fine. I format the URL in this case using the &amp; instead of just & like it is supposed to. However, if I call the open window function (same function) from within a straight <s cript> tag statement, no matter whether I build the URL with &amp; or &, FF is automatically forcing the URL to use &amp; and it will not work within a window.open command!! Uuughhh!

Here is the javascript function being called in every case:

Code:


function msnl_OpenWindow(msnl_sURL) {
  ViewNls=window.open(msnl_sURL,'ViewNewsletter','width=800,height=600,menubar,scrollbars,resizable,left=0,top=0');
}


The following code works just fine:

Code:


$url = "modules.php?name=$msnl_sModuleNm&amp;op=msnl_nls_view&amp;msnl_nid=$nid";
echo "<a href=\"j avascript:msnl_OpenWindow('$url')\" title=\""._MSNL_NLS_LNK_VIEWNL."\">$topic</a>";


The anchor tag above displays & in both IE and FF and it passes to the function retaining the & and works just fine.

However, if I call it like this, it does not:

Code:


      $msnl_sURL   = "modules.php?name=".$msnl_sModuleNm."&op=msnl_nls_view&msnl_nid=1";

      echo "<s cript type=\"text/j avascript\">\n"
         ."<!--\n"
         ."if (msnl_iPreviewON) { msnl_OpenWindow('".$msnl_sURL."'); }\n"
         ."msnl_iPreviewON = 0;\n"
         ."//-->\n"
         ."</s cript>\n";


The & signs are being converted by FF's J avascript parser into &amp; and then FF does not recognize the passed URL arguments that were being passed into the new window's url.

I have been pushing on this all morning and just can't seem to figure out what to do to fix this undesireable behaviour in FF.

Any ideas?

TIA,
montego

_________________
Only registered users can see links on this board! Get registered or login!
Only registered users can see links on this board! Get registered or login! 
View user's profile Send private message Visit poster's website
Raven
Site Admin/Owner



Joined: Aug 27, 2002
Posts: 17088

PostPosted: Thu Jan 26, 2006 11:53 am Reply with quote

Go with transitional instead of strict, imo.
 
View user's profile Send private message
djmaze
Subject Matter Expert



Joined: May 15, 2004
Posts: 727
Location: http://tinyurl.com/5z8dmv

PostPosted: Thu Jan 26, 2006 6:28 pm Reply with quote

use the CDATA tag
 
View user's profile Send private message Visit poster's website
Display posts from previous:       
Post new topic   Reply to topic    Ravens PHP Scripts And Web Hosting Forum Index -> Other - Discussion

View next topic
View previous topic
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You can attach files in this forum
You can download files in this forum


Powered by phpBB © 2001-2007 phpBB Group
All times are GMT - 6 Hours
 
Forums ©