I'm a beginner, so I'm sure I'm doing something stupid. In loadIt(), I open a page in a second window, and get a reference to the window object, x. In the first line in loadFromDs(), I get an element from the second window by ID, and set it to y.
This works fine when run locally in safari, no error. Put it on my server and run it and the first statement of loadFromDs() generates this error: TypeError: Result of expression 'x.document' [undefined] is not an object.
What am I doing wrong? Thanks. Here's my code:
This works fine when run locally in safari, no error. Put it on my server and run it and the first statement of loadFromDs() generates this error: TypeError: Result of expression 'x.document' [undefined] is not an object.
What am I doing wrong? Thanks. Here's my code:
Code:
var x;
var y;
function loadIt()
{
var g = "http://www.autofind.com/group/listing/216-2389/used/?f_make=All&f_model=All&f_trim=All&f_year=All&f_body=All&f_stockvin="
x=window.open(g + document.getElementById("stock").value,'vehicle','width=200,height=100')
}
function loadFromDs()
{
var y=x.document.getElementById("trow0");
var p = y.innerHTML;
document.getElementById("output2").value = p;
//do more stuff
}