How can I access an Iframe via javascript without the iframe having a name or Id. I understand they fall into the frames category and may be accessed with something like
<script>
alert(document.frames[0].n_one.value);
</script>
However I have tried various frames commands and no help.
Even the below don't work.
<a href="javascript:doit()";>Go do it</a>
<script>
function doit() {
alert(document.frames[0].forms[0]n_one.value);
}
</script>
This is an attempt to access an unnamed iframe and get the value located in n_one that is part of the iframed page.
Even tried the below with no help.
<a href="javascript:doit()" target="frames[0]";>Go do it</a>
<script>
function doit() {
alert(document.forms[0].n_one.value);
}
</script>
It works fine if I give the iframe a name like name=joeboy
then it works fine as below. Problem is the actual page has the iframe unnamed.
<a href="javascript:doit()" target="joeboy";>Go do it</a>
<script>
function doit() {
alert(document.forms[0].n_one.value);
}
</script>
Any advice will be greatly appreciated.
<script>
alert(document.frames[0].n_one.value);
</script>
However I have tried various frames commands and no help.
Even the below don't work.
<a href="javascript:doit()";>Go do it</a>
<script>
function doit() {
alert(document.frames[0].forms[0]n_one.value);
}
</script>
This is an attempt to access an unnamed iframe and get the value located in n_one that is part of the iframed page.
Even tried the below with no help.
<a href="javascript:doit()" target="frames[0]";>Go do it</a>
<script>
function doit() {
alert(document.forms[0].n_one.value);
}
</script>
It works fine if I give the iframe a name like name=joeboy
then it works fine as below. Problem is the actual page has the iframe unnamed.
<a href="javascript:doit()" target="joeboy";>Go do it</a>
<script>
function doit() {
alert(document.forms[0].n_one.value);
}
</script>
Any advice will be greatly appreciated.