codetoad.com
  ASP Shopping CartForum & BBS
  - all for $20 from CodeToad Plus!
  
  Home || ASP | ASP.Net | C++/C# | DHTML | HTML | Java | Javascript | Perl | VB | XML || CodeToad Plus! || Forums || RAM 
Search Site:
Search Forums:
  problem getting prompt window to work on IE  userdak at 00:36 on Sunday, September 28, 2008
 

hi. having a problem getting the below code to work in IE; works fine in FireFox:

#!/bin/perl

################################################################################

print "Content-type: text/html\n\n";
print "<?xml version='1.0' encoding='iso-8859-1'?>\n";
print "<html xmlns='http://www.w3.org/1999/xhtml'>\n";
print ("<script language=javascript>\n");
print ("<!--\n");
print ("document.write(prompt(\"what is it\",\"\"))\n");
print ("//-->\n");
print ("</script>\n");
print "<head>\n";
print "<title>Untitled Document</title>\n";
print "</head>\n";

print "<body>\n";
print "<p>the text</p>\n";



print "</body>\n";
print "</html>\n";


  Re: problem getting prompt window to work on IE  S_Flex at 12:17 on Sunday, September 28, 2008
 

your HTML is malformed with
<?xml version='1.0' encoding='iso-8859-1'?>
at the top, but that's not the problem your having.

Your problem is more IE and Javascript not Perl.
From what I gather.
"By default Internet Explorer 7.0 disables standard JavaScript prompt() function due to security reasons. Although users can enable this function again it's very unlikely that they will do so." - http://www.anyexample.com/webdev/javascript/ie7_javascript_prompt()_alternative.xml

For your malformed XHTML try this instead - http://www.w3schools.com/xhtml/xhtml_dtd.asp

print "Content-type: text/html\n\n";
print <<HTML;
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml">
<script language=javascript>
<!--
document.write(prompt("what is it",""))
//-->
</script>
<head>
<title>Untitled Document</title>
</head>

<body>
<p>the text</p>

</body>
</html>
HTML

As you can see I have most everything in one print and the XHTML uses Transitional and not the harder XHTML 1.0 Strict. You can always use the http://www.w3schools.com/ linke to find the HTML header if you prefer.










CodeToad Experts

Can't find the answer?
Our Site experts are answering questions for free in the CodeToad forums
//








Recent Forum Threads
•  Re: The Ballarat Airline Company (BAC)
•  Exciting Open Source Project in C++
•  Re: problem getting prompt window to work on IE
•  Re: Problem in perl scripting.
•  Re: ridding of beginning/ending spacebars in each element of a list.
•  Excel to XML
•  DHTML tutorials?
•  Re: Problem to declare global variable in Object oriented perl
•  Issue with Javascript between web servers


Recent Articles
ASP GetTempName
Decode and Encode UTF-8
ASP GetFile
ASP FolderExists
ASP FileExists
ASP OpenTextFile
ASP FilesystemObject
ASP CreateFolder
ASP CreateTextFile
Javascript Get Selected Text


© Copyright codetoad.com 2001-2008