I may be able to get help writing a cookie, which I find unbelievably
hard (compared to ASP)..
I know the value of the form field in my function that is called first.
I see it when I do alert(formEl.name); pretty cool.
How do I put it in a cookie called "whichField"?
CODE:
function openCarrierWin(formEl) {
var formElement = formEl.options
if (formElement[formElement.selectedIndex].className == "newwin") {
window.open((formElement[formElement.selectedIndex].value),
"carrierWin", "resizable=1,height=625,width=700");
// set cookie here with the value of
alert(formEl.name);
}
else if (formElement[formElement.selectedIndex].value != "none") {
return false;
}
}
P.s. I have searched and searched on cookies but they are overly
complex. I will take a look at the FAQ page I got earlier and see if
your site explains cookies in javascript better. The thing is I dont
want to write function after function for cookies. In asp it is soo
easy. Response.Cookies("name") = "whichField" or something like that.
Can someone show me javascript like that in one line?
jo********@gmail.com wrote:
I see how the window.opener works, pretty neat in that the pop window
knows the parent.
Is there a property that also knows the form field parent?
My function does not know which of the 3 select menus called it.
What can I do?
function onCarrierSelect() {
//
var frm = document.carrRequestForm.carrierList.selectedIndex
var selectCar =
document.carrRequestForm.carrierList.options[frm].text;
alert(selectCar);
if (window.opener && !window.opener.close)
window.opener.document.form(x how make global?).nbcarrier(x how make
global?).value = selectCar
window.close();
}
p.s. as an aside I know the form field name, it is literally in the
querystring, but that is ASP/vbscript and no way to get it into the
jscript function...