Reply to Re: Javascript window.open fails in IE

Your name:

Reply:


Posted by Randy Webb on 09/20/05 01:35

McKirahan said the following on 9/19/2005 5:56 PM:
> <gleverett@gmail.com> wrote in message
> news:1127160660.056969.64100@g43g2000cwa.googlegroups.com...
>
>>I have been searching the 'Net, and I can't find the right solution
>>here. I am writing some PHP pages that utilize some Javascript. The
>>script works in Mozilla/Netscape, but fails in IE. I don't know if
>>it's the Javascript or the PHP that is causing the problem. I started
>>with an example in a book and added on.
>>
>>The script I'm using is:
>>
>><SCRIPT LANGUAGE="Javascript" TYPE="text/javascript">
>><!--
>> function open_window(url) {
>>var NEW_WIN = null;
>>NEW_WIN = window.open ("", "Record Viewer", "toolbar=no,width=<?php
>> echo $new_win_width ?>,height=<?php echo new_win_height
>>?>,directories=no,status=no,scrollbars=yes,resizable=yes,menubar=no");
>>NEW_WIN.location.href = url;
>>}
>>
>>//-->
>></SCRIPT>
>>
>>(I added some line break to make it readable The NEW_WIN line is all
>>on one line.)
>>
>>The PHP variables get added correctly, and the two calls from the PHP
>>program are similar to:
>>
>><a
>>href="javascript:open_window('$PHP_SELF?action=action1');\">Action1</a>
>>
>>or an
>>
>>echo "<button
>>onClick=\"javascript:open_window('$PHP_SELF?action=insert_record');\" >
>>Insert new record</button>";
>>
>>These work fine in Netscape/Mozilla, but in IE, after clickng a bunch
>>of times, I get "Domain not found". I've replaced PHP_SELF with the
>>full URL to test, and it still fails. I know that the scripting is
>>turned on in IE becuase I can go to example sites and the window.open
>>function works.
>>
>>Any ideas as to what's going on here?
>
>
>
> I tested with this variation:
>
> <html>
> <head>
> <title>js_php.htm</title>
> <script type="text/javascript">
> function open_window(url) {
> var cfg = "width=<?php echo $new_win_width ?>,"
> cfg += "height=<?php echo new_win_height ?>,";
> cfg += "scrollbars=yes,resizable=yes"
> var win = window.open ("","Record Viewer",cfg);
> win.location.href = url;
> }
> </script>
> </head>
> <body onload="open_window('http://www.google.com/')">
> </body>
> </html>
>
> and it didn't work for me under IE (5.5) either.
>
> My guess is that IE doesn't interpret inline php.

Since php is processed on the server (with an exception and that is a
plugin that allows php to be clientside), whether IE interprets it or
not is totally dependent on whether PHP is enabled on the server. Try
changing your window name to no spaces, remove the PHP code, and see
what happens.

--
Randy
comp.lang.javascript FAQ - http://jibbering.com/faq & newsgroup weekly
Answer:It destroys the order of the conversation
Question: Why?
Answer: Top-Posting.
Question: Whats the most annoying thing on Usenet?

[Back to original message]


Удаленная работа для программистов  •  Как заработать на Google AdSense  •  England, UK  •  статьи на английском  •  PHP MySQL CMS Apache Oscommerce  •  Online Business Knowledge Base  •  DVD MP3 AVI MP4 players codecs conversion help
Home  •  Search  •  Site Map  •  Set as Homepage  •  Add to Favourites

Copyright © 2005-2006 Powered by Custom PHP Programming

Сайт изготовлен в Студии Валентина Петручека
изготовление и поддержка веб-сайтов, разработка программного обеспечения, поисковая оптимизация