Forum Moderators: open

Message Too Old, No Replies

JavaScript and iframe

targeting 1 iframe with 3+ onClick fjf

         

Natko

9:58 am on Oct 28, 2003 (gmt 0)

10+ Year Member



Hi everybody,

I have some gramatical problem.
Instead of an .gif like following
<a href="something.html" target="iframe" onclick="return goAnchor(this.target);"><img src="some.gif"></a>
I've tried to do the same with input type="submit" like
<input type="submit" value="something" class="button" onClick="location.href='#.html';">
but not as a pop-up but as an if frame like
<iframe id="iframe" name="iframe" src="descrizione_tisno.html" width=500 height=300 scrolling=no frameborder="0" class="frame">

Could somebody can halp me
thanks
:-)

RonPK

11:39 am on Oct 28, 2003 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Welcome to WebmasterWorld, Natko.

I don't get it.
* what does the function goAnchor() do?
* are you submitting a form, or are you using the submit button simply because you need a button?
* what is supposed to happen when someone clicks the button?

Natko

1:16 pm on Oct 29, 2003 (gmt 0)

10+ Year Member



hello,
the function is following
<script type="text/javascript">
<!--
function getText() {
var myText = null;
if (document.location.href.indexOf("#") > -1)
myText = document.location.href.substring(0, document.location.href.indexOf("#"));
else
myText = document.location.href;
return myText;
}
function goAnchor(anc) {
var myText = getText();
if (myText.indexOf("#") > -1)
myText += anc;
else
myText += ("#" + anc);
document.location.href = myText;
return true;
}
//-->
</script>

and the link for iframe was

<a href="html_page_to_load_into_iframe.html" target="iframe" onclick="location.href(this.target);"><img src="#.gif"></a>

but, now I don't need it becouse I did it in much simplier way becouse I wanted to use a button as a button to load html into iframe.

Now I have:

<input type="submit" value="#" class="button" onClick="parent.iframe.location.href='html_page_to_load_into_iframe.html';">

so the problem is solved now
thanks anyway
:-)