Change your 6 line to:

    myJob1.Id = opportunity.records[0].Opportunityid;

The `sforce.connection.query` method doesn't return the specified field, but rather a `List<SObject>`.