Solved

document.write() alternative?

Posted on 1998-10-29
4
365 Views
Last Modified: 2008-03-10
Using Javascript, I want to be able to collect multiple screens of information from user forms in cases where I don't have to go back to the host.  So I want to replace existing windows with new ones based on info from the form.  For small amounts of information, building new screens with document.write() works OK.  But, using document.write() for large amounts of info is clumsy (everything needs to be squished up on a single line)  Is there some other way to do this, or is there some way to use document.write() w/o having to squish up everything?
0
Comment
Question by:lennyh
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
  • 2
4 Comments
 
LVL 2

Expert Comment

by:Grdv
ID: 1273179
well, without squishing:
var tmptext='<body bgcolor="black" text="white">'
tmptext+='<table border=1 cellspacing=0 cellpadding=0>'

//and so on... note the use of single quotes to enable double qoutes inside...

document.write(tmptext);
if that was what you meant...
another way of doing it is to use something like this:
var tmpwindow = window.open('') // **not sure about this one
tmpwindow.location=tmptext; //tmptext is the same as above...


**not sure about this one: why? well I'm not sure that's the way of opening up nothing in the current frame, but if it's a specific frame, and you know the name of it, the line should be:
var tmpwindow = window.open('','**framename**') // ** sure about this one
where **framename** represents the frames name.

hope it helped

//Grdv
0
 

Author Comment

by:lennyh
ID: 1273180
Grdv,

Thanks for your response.  Sure seems like that will work.  Still a tiny bit clumsy, but a whole lot better than what I was trying to do.

I'll take it.

Regards,

Lenny
0
 
LVL 2

Accepted Solution

by:
Grdv earned 100 total points
ID: 1273181
oops, was supposed to be posted as an answer... :)
well, the most important thing is that you got what you needed

//Grdv
0
 

Author Comment

by:lennyh
ID: 1273182
Grdv, thanks for your clear and responsive answer.
0

Featured Post

Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

JavaScript can be used in a browser to change parts of a webpage dynamically. It begins with the following pattern: If condition W is true, do thing X to target Y after event Z. Below are some tips and tricks to help you get started with JavaScript …
Nothing in an HTTP request can be trusted, including HTTP headers and form data.  A form token is a tool that can be used to guard against request forgeries (CSRF).  This article shows an improved approach to form tokens, making it more difficult to…
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…

696 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