iframe question

Status
Not open for further replies.

sherwood

Active Member
805
2008
0
0
right,

on my site i got an iframe which has an option to open and close it,

i was wondering is there any way i can get it to like auto scroll down or the iframe open up at a position like 600px down the page?
 
9 comments
Yeah, if you read the question, i didn't need to know how to make an iframe as I have already made one,
What i need is when my iframe is opened it to be positioned at a certain place.
 
Example of Resizing iframe according to its own content:

Code:
In the [B]head[/B] of your document enter the following JavaScript code:
 [FONT=Courier New][SIZE=3][COLOR=#000000]<[COLOR=#800080]script language[/COLOR]=[COLOR=#ff00ff]"JavaScript"[/COLOR]>
<!--
[COLOR=#ff0000]function [/COLOR][COLOR=#800080]calcHeight[/COLOR]()
{
  [COLOR=#008000][I]//find the height of the internal page[/I][/COLOR]
  [COLOR=#ff0000]var[/COLOR] [COLOR=#800080]the_height[/COLOR]=
    [COLOR=#ff0000]document[/COLOR].[COLOR=#ff0000]getElementById[/COLOR]([COLOR=#ff00ff]'the_iframe'[/COLOR]).[COLOR=#ff0000]contentWindow[/COLOR].
      [COLOR=#ff0000]document[/COLOR].[COLOR=#800080]body[/COLOR].[COLOR=#800080]scrollHeight[/COLOR];

  [COLOR=#008000][I]//change the height of the iframe[/I][/COLOR]
  [COLOR=#ff0000]document[/COLOR].[COLOR=#800080]getElementById([/COLOR][COLOR=#ff00ff]'the_iframe'[/COLOR][COLOR=#800080])[/COLOR].[COLOR=#ff0000]height[/COLOR]=
      [COLOR=#800080]the_height[/COLOR];
}
[COLOR=#008000][I]//-->
[/I][/COLOR]</[COLOR=#800080]script[/COLOR]>
[/COLOR]
[/SIZE][/FONT]  and in the [B]body[/B] create the iframe tag: 

[FONT=Courier New][SIZE=3][COLOR=#000000]<[COLOR=#800080]iframe [/COLOR][COLOR=#ff0000]width[/COLOR]=[COLOR=#ff00ff]"700" [/COLOR][COLOR=#800080]id[/COLOR]=[COLOR=#ff00ff]"the_iframe" [/COLOR]
    [COLOR=#ff0000]onLoad[/COLOR]=[COLOR=#ff00ff]"calcHeight();" [/COLOR]
    [COLOR=#ff0000]src[/COLOR]=[COLOR=#ff00ff]"testing_page.shtml"[/COLOR] 
    [COLOR=#ff0000]scrolling[/COLOR]=[COLOR=#ff00ff]"NO"[/COLOR] 
    [COLOR=#ff0000]frameborder[/COLOR]=[COLOR=#ff00ff]"1"[/COLOR] 
    [COLOR=#ff0000]height[/COLOR]=[COLOR=#ff00ff]"1"[/COLOR]>
An iframe capable browser is 
required to view this web site.
</[COLOR=#800080]iframe[/COLOR]>
[/COLOR][/SIZE][/FONT]
 
Code:
<script type="javascript">
function jumpScroll() {
       window.scroll(0,600);
}
</script>

<body onload="jumpScroll()">
content goes here
</body>
 
right, well i'm not to clued up on html and coding and crap like that so i'm still a bit stuck.

where would I add this:
Code:
<script type="javascript">
function jumpScroll() {
       window.scroll(0,600);
}
</script>

<body onload="jumpScroll()">
content goes here
</body>
As what I am trying to do is integrate a link checker in to the code box in vbulletin,

this is what i got so far for coding it:

Code:
<div style="margin:20px; margin-top:5px">
    <div class="smallfont" style="margin-bottom:2px">$vbphrase[code]:&nbsp;[[B]<a onclick="HideFrameComingSoon()">Click to Open/Close Link Checker</a>]

<iframe id="comingsoon" allowtransparency="true" style="display:none; padding: 10px" scrolling="yes" src="http://tubenow.net/check.php?url=$_SERVER[SERVER_NAME]$_SERVER[REQUEST_URI]" width="80%" height="550"></iframe>[/B]
<script language="javascript">
<!--
function HideFrameComingSoon() {
var fr = document.getElementById ("comingsoon");
if(fr.style.display=="none") {
fr.style.display="block";
}
else {
fr.style.display="none";
}
}
-->
</script></div>
    <pre class="alt2" dir="ltr" style="
        margin: 0px;
        padding: $stylevar[cellpadding]px;
        border: 1px inset;
        width: $stylevar[codeblockwidth];
        height: {$blockheight}px;
        text-align: left;
        overflow: auto">$code</pre>
</div>


The bit in bold is the link checking part.

And what I am wanting to do is when someone clicks Open (to open the iframe) is for it to open but i want it to open at a certain position something like 600px
 
Code:
<script type="javascript">
function jumpScroll() {
       window.scroll(0,600);
}
</script>

<body onload="jumpScroll()">
content goes here
</body>

In the actual page loading inside the iframe, the content of the page needs to be where it says "content goes here".
 
hmm,
lol sorry. i'm still lost,

i tried this thing in to places,
1st I put the first part in the header template and the seccond part in the footer but didn't work,
so i then tried to put in into the actual bbcode template where the iframe is like this.

Code:
<div style="margin:20px; margin-top:5px">
    <div class="smallfont" style="margin-bottom:2px">$vbphrase[code]:&nbsp;[<a onclick="HideFrameComingSoon()">Click to Open/Close Link Checker</a>]
[B]<script type="javascript">
function jumpScroll() {
       window.scroll(0,600);
}
</script>

<body onload="jumpScroll()">[/B] 
 <iframe id="comingsoon" allowtransparency="true" style="display:none; padding: 10px" scrolling="yes" src="[URL="http://tubenow.net/check.php?url=$_SERVER%5BSERVER_NAME%5D$_SERVER%5BREQUEST_URI%5D"]http://tubenow.net/check.php?url=$_SERVER[SERVER_NAME]$_SERVER[REQUEST_URI][/URL]" width="80%" height="550">[B]</body>[/B]</iframe>

<script language="javascript">
<!--
function HideFrameComingSoon() {
var fr = document.getElementById ("comingsoon");
if(fr.style.display=="none") {
fr.style.display="block";
}
else {
fr.style.display="none";
}
}
-->
</script></div>
    <pre class="alt2" dir="ltr" style="
        margin: 0px;
        padding: $stylevar[cellpadding]px;
        border: 1px inset;
        width: $stylevar[codeblockwidth];
        height: {$blockheight}px;
        text-align: left;
        overflow: auto">$code</pre>
</div>

any help? :'(
 
The actual PAGE being loading INSIDE the iframe is where the code should be.. So in tubenow.net/check.php

That file needs to be edited...

You can send me the PHP file check.php and I can do it if you can't do it yourself.
 
Status
Not open for further replies.
Back
Top