PDA

View Full Version : js call to anchor in <iframe.>



digital420
05-26-2006, 07:03 AM
I am capturing from the request a value and want to find it in an iterited list i have in a jsp.

I made an anchor statement <a name="(request.value)" and it's iterated in a td set in a table, producing exactly as it should. I want to though capture the last edited value (which im passing in the request) and find it in the list of anchor'd row's in the iterated table.

so what i'm doing is

var iam = document.userListFrm.lastEdited.value;
if ( document.userListFrm.lastEdited.value == 'null') {
alert('no one to find');
}
else {
alert(iam );
usersLister.location.href='document.userListFrm.lastEdited.value';
}
}

usersLister is the name of the iframe. and the jsp loads the value in the hidden field lastEdited.

anyone wanna let me know how i would call to the anchor, i used to use a goto command. not sure if it would be the best application here.

DiGiTaL

jscheuer1
05-29-2006, 07:48 AM
I'd try:


usersLister.location.href='pageName.htm#'+document.userListFrm.lastEdited.value;

where:

pageName.htm

is the actual name of the page and document.userListFrm.lastEdited.value is the anchor name. If the page is already loaded in the frame/iframe, then this might work:


usersLister.location.href='#'+document.userListFrm.lastEdited.value;

The important thing to remember (as I'm not clear on what your variable document.userListFrm.lastEdited.value contains) is that in passing a variable to location.href=, it should not be quoted, if you put quotes around it, it becomes a literal string and no longer represents the value that it held.