[thelist] Javascript blues...

John Corry webshot at neoncowboy.com
Thu Sep 28 02:49:44 CDT 2000


Following the successful deployment of some pages that use document.write to
generate simple code...I had an idea: WHat if I could modify the function so
that it opens a new window, takes an image's width (winx), height (winy),
filename (pic) and a title (title) as arguments. I want the function to open
a new window, and give it the source code contained in the var pictureCode.


//function to open window, with all the required arguments, plus my custom
ones

function picWindow(winy, winx, pic, title){
	open("", "pictureWindow", "toolbar=no, location=no, directories=no,
status=no, menubar=no, scrollbars=no, resizable=yes, width=" + winy + ",
height=" + winx, winy, winx, pic, title)

// source variable declared and document.write into the new document/window.
	if (picWindow != null) {
		// write this code into it
		var pictureCode = "<html><head><title>" + title + "</title></head>"
		pictureCode += "<body bgcolor=\"#ffffff\">"
		pictureCode += "<div style=\"border: 0; margin: 0; padding: 0;
padding-bottom: 0; padding-left: 0; padding-right: 0; padding-top: 0;
margin-bottom: 0; margin-left: 0; margin-right: 0; margin-top: 0;\">"
		pictureCode += "<img src=" + pic +".jpg"
		pictureCode += "</div>"
		pictureCode += "</body>"
		pictureCode += "</html>"

		pictureWindow.document.write (pictureCode)
		}
	}

	...
<!-- the link that is supposed to trigger the function -->
	<a href="javascript: picWindow('700','500','lip_smack_lg','Some guy
smacking it at Hookipa')"><img
src="/simmer%20style/images/lip_smack_sml.jpg" width="240" height="180"
alt="" border="1" align="left"></a>

So far, I can open the wiondow...but the only source available in that
window is '<html></html>', hardly the whole variable pictureCode...

thanks,
John Corry





More information about the thelist mailing list