Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

using opener in N6

Status
Not open for further replies.

tinkler

Programmer
Aug 19, 2003
8
US
I have just started to learn about the wonderful world of JavaScript and have the following problem:

I am using this script (called by an onLoad):

<script language =&quot;JavaScript&quot;>
function datenubernehmen()
{
a = opener.printybestell.printymodel.value;
b = opener.printybestell.printyschrift.value;
c = opener.printybestell.printyfarbe.value;
bild = opener.vorschau.src;
bildwidth = opener.vorschau.width;
bildheight = opener.vorschau.height;
document.printybestellzwei.printymodel.value = a;
document.printybestellzwei.printyschrift.value = b;
document.printybestellzwei.printyfarbe.value = c;
document.vorschau.src = bild;
document.vorschau.width = bildwidth;
document.vorschau.height = bildheight;
opener.close();
}
// -->
</script>

to transfer form and picture source data from one page (the opener) to the currently active page (document). It works fine with IE, but N6 seems to ignore the script completely.

Anyone have any ideas...???
 
use the JavaScript console to see error messages. NS6 stops executing scripts when it reaches an error.

Tasks > Tools > JavaScript Console

Almost everytime you have an error in both IE and NS6 the errror message in the console will be better than the message IE gives you (even with MS debugger installed).

It even tells you what line the error occured inside the js files you included.

Hope this helps. Gary &quot; Haran
 
thanks haran.....the javaconsole says that opener.printybestell has no properties. any idea what this means???
 
please don't use my family name as if it was my first name. Don't take our your frustrations on me for problems you are having with the javascript code especially if I am doing effort to help you.

Now let's take a look at the error message :

opener.printybestell has no properties.

try doing this in IE :

<body onload=&quot;alert(document.mytest)&quot;>

Now try putting this in the head of your document :

<script>
document.mytest = &quot;something&quot;
</script>

and do the same alert as before in the onload.

You will get &quot;something&quot; as the result of your alert.

Javascript allows you to verify if something exist as well.

try this :

<body onload=&quot;if(document.anotherThing){alert('it exists')}else{alert('it doesn\' exist')}&quot;>

so what would happen if you tried to access a property of document.anotherThing by appending something to it :

document.anotherThing.yetMoreStuff = &quot;test&quot;;

It would tell you that document.anotherThing has no properties.

Now what you have to understand is that the document object model (DOM) is not the same in Internet Explorer and Netscape.

Netscape requires :

opener.document.element

rather than just :

opener.element

Hope this helps. Gary &quot; Haran
 
Sorry Gary; I didn't see you first name in your orig. message. Thanks for the info. I'll try it out straight away. Again, sorry for any offence not meant. Best, R.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top