***Java variable pass via url, failing on an if statement...

S

Steve Easton

When the page opened at the link posted, I got 3 javascript run time errors.
You might want to look for a different script.

--
Steve Easton
Microsoft MVP FrontPage
95isalive
This site is best viewed............
........................with a computer
 
S

Steve Easton

Here is an example of a script that will write data to a page:

<script language="JavaScript">
var img
var imageToLoad
var sVarA
var sVarRS
var newwindow
var newdocument
var sToPass
function newWindow(img){
imageToLoad = new Image();
new function testit(){
imageToLoad.src = (img);
// we need a little pause while the script gets the image since the image is on the server,
// or the browser will open the window and write the script before the image is cached,
// which causes the script to write zeros for the resizeto dimensions.
setTimeout(loadit,1000);
function loadit(){
sVarA = ("left=20px"+",top=20px"+",width="+imageToLoad.width+",height="+imageToLoad.height);
sVarRS = 'onload="resizeTo('+imageToLoad.width+','+imageToLoad.height+')"'
sToPass='<html><head>\n';
sToPass+='<style type="text/css"> body{ background-repeat: no-repeat; }</style>\n';
sToPass+='<title>'+img+'</title>\n';
sToPass+='</head>\n';
sToPass+='<body '+sVarRS+' background='+img+'><p align=center>www.95isalive.com</p>\n';
sToPass+='</body></html>';
//check to see if we have the dimensions and if not, go back and wait another 1 second
if ( imageToLoad.width = 0 ){ testit(); }
else
newwindow = window.open('','',sVarA);
newdocument = newwindow.document;
newdocument.write(sToPass);
newdocument.close();
}}}
</script>

It is used on this page: http://www.95isalive.com/test/

The new "pages" that open with the images do not actually exist. The script creates them "on the
fly"

If you modify this line: newwindow = window.open('','',sVarA);
you can specify a file to open and write to.


--
Steve Easton
Microsoft MVP FrontPage
95isalive
This site is best viewed............
........................with a computer
 
S

Steve Easton

3 errors before the page finishes loading.

--
Steve Easton
Microsoft MVP FrontPage
95isalive
This site is best viewed............
........................with a computer
 
F

Frank H. Shaw

I had left the name of the file on your desktop referenced in the html,
instead of the name I designated the online file... Woops, so I made that
alteration and the online form/query is operable now.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top