Will the src attribute always be the same? You could select it by:
var frame = $("iframe[src='www.mysite.com']");
Edit:
Here is how you can get and append the cookie:
Document.cookie will return the entire cookie as a string, and I am guessing you probably only want a certain value from that cookie. So you could do something like:
// This is just declaring a function that you can use to get cookie values.
function getCookie(cookieName) {
// If you open up your console and type in document.cookie, you will see
// that all cookie values are inside of this same string. So this
// function will allow you to extract the value you are looking for
// We start by creating a new Regular Expression object, that will
// be used to match a certain pattern of text.
var re = new RegExp('[; ]'+cookieName+'=([^\\s;]*)');
// This line actually uses our pattern, and returns the match from
// the cookie.
var sMatch = (' '+document.cookie).match(re);
// if we have a cookie name, and our regular expression found a match
// in the cookie, then return the value that was found from the match
if (cookieName && sMatch) {
return unescape(sMatch[1]);
}
// if we dont find a matching value, just return an empty string
return '';
}
Which allows you to do something like:
// Now we are actually CALLING our function, and pass in whatever we named
// our cookie value. The variable cookieValue will then hold this value.
var cookieValue = getCookie("cookieName");
// Here we are using jQuery to find the iframe element we want to manipulate
// and save reference to it in a variable called 'frame'
var frame = $("iframe[src='www.mysite.com']");
// From this element, we grab it's current src value
var currentSrc = frame.attr("src");
// here, we SET the frames src value, by setting it back to it's current src
// and tack on the cookie value
frame.attr("src", currentSrc + "&" + cookieValue);