Solved

JS tag on the fly

Posted on 1997-11-14
1
227 Views
Last Modified: 2006-11-17
I'm trying to make an html page on the fly with a JS tag included in the head of the document created but Netscpe won't include it but IE will. When I view the source of the created page, Netscape won't show this tag
<SCRIPT SRC="testing.js" LANGUAGE="javascript"></SCRIPT>
in the head. If I can get Netscape to show the above tag, then I can solve my problem at http://www.geocities.com/Yosemite/3999/xtra.html which is what I'm trying to accomplish without errors.
Here's the srcipt
<HTML>

<HEAD>
<TITLE>The Team of NZ</TITLE>

<script language="javascript">
<!--
function makeWindow(who,desc) {

   var newWindow =window.open("","","width=320,height=150")
    if (newWindow != null) {
     // assemble content for new window
     var newContent = "<HTML>" + "\n"
         newContent += "<HEAD>" + "\n"
         newContent += "<TITLE>" + who + "\'s Window</TITLE>" + "\n"
         newContent += "<SCRIPT SRC=\"testing.js\" LANGUAGE=\"javascript\"></SCRIPT>" + "\n"
         newContent += "</HEAD>" + "\n"
         newContent += "<BODY BGCOLOR=\"green\" TEXT=\"gold\">"   + "\n"
         newContent += "<CENTER>" + "\n"
         newContent += "<h1>" + who + "</h1>" + "\n"
         newContent += desc + "\n"
         newContent += "</center>" + "\n"
         newContent += "</body></html>" + "\n"
         // write HTML to new window document
         newWindow.document.write(newContent)
         newWindow.document.close() // close layout stream
      }


}
// end script -->

</SCRIPT>
</head>
<BODY BGCOLOR="black" TEXT="cyan" LINK=cyan VLINK=red>
<CENTER>

<a HREF="javascript:makeWindow('Tom & Jacqui', 'Tom(graphics XTRAordinaie) a bit serious on his work.')">test</a>
<P>

<a HREF="javascript:makeWindow('Melissa', 'Graphics whiz Melissa, determined to get it right')">test1</a>
<P>

<a HREF="javascript:makeWindow('Vict the Man', 'That\'s me working very hard on those very tricky HTML')">test2</a>
<P>

<a HREF="javascript:makeWindow('Rennie', 'The very friendly receptionist who loves her work')">test3</a>
<P>

<a HREF="javascript:makeWindow('Tom', 'Who threw that?')">test4</a>


</center>
</body>
</html>
0
Comment
Question by:vag118
1 Comment
 
LVL 10

Accepted Solution

by:
kollegov earned 100 total points
Comment Utility
I solved this problem with the following code

var sss="SCRIPT>"
document.writeln("<"+ssss);
.....rest of your javascript created on-fly....
document.writeln("</"+ssss);

so instead of:

newContent += "<SCRIPT SRC=\"testing.js\"                 LANGUAGE=\"javascript\"></SCRIPT>" + "\n"

you can write:
sss="SCRIPT"
newContent += "<"+sss+"> SRC=\"testing.js\"
      LANGUAGE=\"javascript\"><"+sss+">" + "\n"

0

Featured Post

How to run any project with ease

Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
- Combine task lists, docs, spreadsheets, and chat in one
- View and edit from mobile/offline
- Cut down on emails

Join & Write a Comment

Suggested Solutions

Title # Comments Views Activity
jQuery Time Off Event 20 41
Website Home page blank 4 25
Where to begin studying? 5 63
coldfusion, javascript onclick url update 4 25
This article shows how to create and access 2-dimensional arrays in JavaScript.  It includes a tutorial in case you are just trying to "get your head wrapped around" the concept and we'll also look at some useful tips for more advanced programmers. …
In Part 1 (http://www.experts-exchange.com/Programming/Languages/Scripting/JavaScript/A_7849-Hex-Maze.html) we covered the hexagonal maze basics -- how the cells are represented in a JavaScript array and how the maze is displayed.  In this part, we'…
The viewer will learn the basics of jQuery, including how to invoke it on a web page. Reference your jQuery libraries: (CODE) Include your new external js/jQuery file: (CODE) Write your first lines of code to setup your site for jQuery.: (CODE)
The viewer will learn the basics of jQuery including how to code hide show and toggles. Reference your jQuery libraries: (CODE) Include your new external js/jQuery file: (CODE) Write your first lines of code to setup your site for jQuery…

762 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

9 Experts available now in Live!

Get 1:1 Help Now