[thelist] viewing document.write output

Dennis Allio dennis.allio at motivo.com
Wed Jul 24 23:32:01 CDT 2002


Unless I'm missing something you can probably put the contents of the
document.write into a page scoped variable.

// Whatever get's created for the doc write
var myDocWrite = "<p>stuff</p>";
document.write(myDocWrite);

Then write yourself another function from the page that calls an alert
from a plain old link. i.e.

function showMe() {

	alert(myDocWrite);
}

Hope I didn't miss what you were asking.
dennis

-----Original Message-----
From: Tom Dell'Aringa [mailto:pixelmech at yahoo.com]
Sent: Wednesday, July 24, 2002 4:30 PM
To: thelist at lists.evolt.org
Subject: [thelist] viewing document.write output

Hey all, I asked a similar question once, but here it is again with a
different spin. I have made a JS object that writes out some code in
the body of a page. Its working to a point, but my functions are not.
They don't error out either. Problem is - I can't see what my script
has actually written out - you know like looking at the actual source
code. If I look at source, I just get the code with the JS and the
doc.writes, it doesn't show me what was ACTUALLY written out.

I'm doing this both on a local drive, and on a Development server
running JSP. Can anyone suggest how I can see what has been written
by the script to debug?

Below is my code - also if you see something in my JS object you want
to make a suggestion to make better, let me know:

---------------------------------------------------

<script>
//----------------------------------------------------------------------
-----
// EQ Control Object
//----------------------------------------------------------------------
-----

var EQ_BGCOLOR = "#6699cc";
var TICK_WIDTH = 11;
var TICK_HEIGHT_TALL = 10;                    // center and end ticks
var TICK_HEIGHT_NORM = 7;                     // all other ticks
var FONT_FAMILY = "tahoma, sans-serif";
var FONT_SIZE = "11px";                       // label font size
var FONT_COLOR = "#ffffff";
var LABEL_WIDTH = 40;

function EQControl(top, left, labelName, id1, id2, id3, length)
{
	this.top = top;
	this.left = left;
	this.name = labelName;
	this.id1 = id1; //div containing spans identifier
	this.id2 = id2; //single letter prefix id for marking ticks
	this.id3 = id3; //name of control to send as parameter to
functions
	this.length = length;
	this.build = EQControl_buildControl;
}

//----------------------------------------------------------------------
-----
// object methods
//----------------------------------------------------------------------
-----

function EQControl_buildControl()
{
	var length = this.length;
	var id1 = this.id1;
	var id2 = this.id2;
	var id3 = this.id3;
	var labelName = this.name;
	var topLabel = this.top;
	var topBar = this.top + 2;
	var leftLabel = this.left;
	var leftBar = this.left + LABEL_WIDTH;

	var middle = length / 2;

	document.write("<div style=\"color: "+FONT_COLOR+"; font-size:
"+FONT_SIZE+"; font-weight: bold; font-family: "+FONT_FAMILY+";
width: "+LABEL_WIDTH+"px; position: absolute; top: "+ topLabel +"px;
left: "+ leftLabel +"px;\">"+ labelName +"</div>");

	document.write("<div id=\""+ id1 +"\" style=\"position:
absolute;
top:"+topBar+"; left:"+leftBar+";\">");

	for(i=0; i<=length; i++)
	{
		if(i==0 || i==middle || i==length)
		{
			//note: font-size style is required so the spans
take the proper
sizes.

			document.write("<span id=\""+ id2 +"" + i + "\"
onclick=\"controlVA(this.id, "+ length +", \""+ id1 +"\")\"
style=\"font-size:7px; background-color: "+EQ_BGCOLOR+"; width:
"+TICK_WIDTH+"; height: "+TICK_HEIGHT_TALL+"; cursor: hand;
border-right: 1px solid #003366\" onmouseover=\"showBarValue("+i+",
\""+ id1 +"\")\"></span>");
		}
		else
		{
			document.write("<span id=\""+ id2 +"" + i + "\"
onclick=\"controlVA(this.id, "+ length +", \""+ id1 +"\")\"
style=\"font-size:7px; background-color: "+EQ_BGCOLOR+"; width:
"+TICK_WIDTH+"; height: "+TICK_HEIGHT_NORM+"; cursor: hand;
border-right: 1px solid #003366\" onmouseover=\"showBarValue("+i+",
\""+ id1 +"\")\"></span>");
		}
	}

	document.write("</div>");
}

//----------------------------------------------------------------------
-----
// end EQ Object
//----------------------------------------------------------------------
-----

</script>
</head>
<body bgcolor="#003366">
<script>
eq = new EQControl(5, 8, "Yaw", "manualControl", "m", "manual", 20)
eq2 = new EQControl(25, 8, "Pitch", "pitchControl", "p", "pitch", 20)

eq.build();
eq2.build();
</script>

=====
var me = tom.pixelmech.webDeveloper();

http://www.pixelmech.com/
http://www.maccaws.com/
[Making A Commercial Case for Adopting Web Standards]

__________________________________________________
Do You Yahoo!?
Yahoo! Health - Feel better, live better
http://health.yahoo.com
--
For unsubscribe and other options, including
the Tip Harvester and archive of thelist go to:
http://lists.evolt.org Workers of the Web, evolt !



More information about the thelist mailing list