Go Back  Xtreme Visual Basic Talk > Other Languages > Web Programming > iframe


Reply
 
Thread Tools Display Modes
  #1  
Old 03-18-2006, 02:06 PM
gencoglu27's Avatar
gencoglu27 gencoglu27 is offline
Centurion
 
Join Date: Dec 2005
Location: Istanbul
Posts: 108
Default iframe


I have html page from another site I need to use it in an Iframe, is there a way to position the page so only a part of the page is visible.?

The iframe is only 50x400 with one line of text from the other page visible.

<iframe width="200" height="50" src="http://www.yahoo.com ></iframe>
Reply With Quote
  #2  
Old 03-18-2006, 02:13 PM
wayneph's Avatar
wayneph wayneph is offline
Web Junkie

Retired Moderator
* Expert *
 
Join Date: Apr 2004
Location: D/FW, Texas, USA
Posts: 8,393
Default

in javascript try the scrollTo() function.
__________________
-- wayne, MSSM Retired
> SELECT * FROM users WHERE clue > 0
0 rows returned
Reply With Quote
  #3  
Old 03-19-2006, 04:52 AM
gencoglu27's Avatar
gencoglu27 gencoglu27 is offline
Centurion
 
Join Date: Dec 2005
Location: Istanbul
Posts: 108
Default iframe -link..still there is a problem

PHP Code:
<html>
<
head>

<
script type="text/javascript">
function 
scrollWindow()
{
window.scrollTo(500,100);
}
</script>

</head>
<body onload="scrollWindow()">
</body>
</html> 

Last edited by gencoglu27; 03-19-2006 at 06:48 AM.
Reply With Quote
  #4  
Old 03-19-2006, 04:55 AM
gencoglu27's Avatar
gencoglu27 gencoglu27 is offline
Centurion
 
Join Date: Dec 2005
Location: Istanbul
Posts: 108
Default

Hi,
Not sure how to link the webpage I want to use inside iframe tag
can you help me please ?
for example ,I want to use "http://www.yahoo.com" and I want to make the "yahoo logo" visible only
Quote:
Originally Posted by gencoglu27
PHP Code:
<html>
<
head>

<
script type="text/javascript">
function 
scrollWindow()
{
window.scrollTo(500,100);
}
</script>

</head>
<body onload="scrollWindow()">
</body>
</html> 
Reply With Quote
  #5  
Old 03-19-2006, 06:01 AM
gencoglu27's Avatar
gencoglu27 gencoglu27 is offline
Centurion
 
Join Date: Dec 2005
Location: Istanbul
Posts: 108
Default

Okay, I did some google and got the following solution..thanks
PHP Code:

<iframe name="MyIframe" src="img2.html" width="300" height="40"    frameborder="0"scrolling="yes"marginwidth="0"marginheight="0">
</
iframe>
<
script type="text/javascript" language="JavaScript">
function 
scrold() {
var 
PixelsFromTop 190;
var 
PixelsFromLeft 22;
window.MyIframe.scrollTo(PixelsFromLeft,PixelsFromTop);
}
setTimeout('scrold()',2000);
//-->
</script> 
Reply With Quote
  #6  
Old 03-19-2006, 06:46 AM
gencoglu27's Avatar
gencoglu27 gencoglu27 is offline
Centurion
 
Join Date: Dec 2005
Location: Istanbul
Posts: 108
Default

still there is a problem ..

var PixelsFromTop = 190;
var PixelsFromLeft = 22;
in spite of the values above ,it displays top:0 and left:0 ?
There is no effect even if I change the values above..
Whats wrong with this code?
Reply With Quote
  #7  
Old 03-19-2006, 08:42 AM
Lee123's Avatar
Lee123 Lee123 is offline
Junior Contributor
 
Join Date: Aug 2003
Location: Denver Co
Posts: 249
Default

This works:
HTML Code:
<html>
<head>

<script type="text/javascript" language="JavaScript"> 
function scrold() { 
var PixelsFromTop = 20; 
var PixelsFromLeft = 50; 
window.MyIframe.scrollTo(PixelsFromLeft,PixelsFromTop); 
} 
window.onload = scrold;

//--> 
</script>

</head>
<body onload="scrold()">

<iframe name="MyIframe" src="demo.html" width="100" height="100" frameborder="0" 

scrolling="yes" marginwidth="0" marginheight="0"> 
</iframe> 

</body>
</html>
...but, it will only work if the src page is from the same domain....not too sure why though....
Reply With Quote
  #8  
Old 03-19-2006, 08:54 AM
gencoglu27's Avatar
gencoglu27 gencoglu27 is offline
Centurion
 
Join Date: Dec 2005
Location: Istanbul
Posts: 108
Default

does it work for remote web sites? I mean what about ? "http://www.yahoo.com"
I tried but failed...
Reply With Quote
  #9  
Old 03-19-2006, 09:00 AM
Lee123's Avatar
Lee123 Lee123 is offline
Junior Contributor
 
Join Date: Aug 2003
Location: Denver Co
Posts: 249
Default

Not sure why it doesn't work for remote sites (sites not on your domain) but do consider the fact that this is potentially "BandWidth Theft/Hot linking"....
Reply With Quote
  #10  
Old 03-19-2006, 09:28 PM
wayneph's Avatar
wayneph wayneph is offline
Web Junkie

Retired Moderator
* Expert *
 
Join Date: Apr 2004
Location: D/FW, Texas, USA
Posts: 8,393
Default

1. Don't start multiple threads for the same question. It's easier on the people helping you if all the information is together.

2. It's not working on other sites for security reasons. It's called Cross-Site Scripting. I know you just want to scroll but... if you can manipulate the other page, someone could interject script on a page, that submits to a different site with out the user ever knowing. it's a HUGE security risk. That's why browsers don't allow it.
__________________
-- wayne, MSSM Retired
> SELECT * FROM users WHERE clue > 0
0 rows returned
Reply With Quote
  #11  
Old 03-20-2006, 03:39 AM
gencoglu27's Avatar
gencoglu27 gencoglu27 is offline
Centurion
 
Join Date: Dec 2005
Location: Istanbul
Posts: 108
Default

Oh yes,
I should have known that...
yet I managed the use iframe having another web page inside it,
I used a <div> with some CSS ,and hide some unwanted part...and easily located it
in the web site...it took me 1 hour..
Reply With Quote
Reply


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off

Forum Jump

Advertisement:





Free Publications
The ASP.NET 2.0 Anthology
101 Essential Tips, Tricks & Hacks - Free 156 Page Preview. Learn the most practical features and best approaches for ASP.NET.
subscribe
Programmers Heaven C# School Book -Free 338 Page eBook
The Programmers Heaven C# School book covers the .NET framework and the C# language.
subscribe
Build Your Own ASP.NET 3.5 Web Site Using C# & VB, 3rd Edition - Free 219 Page Preview!
This comprehensive step-by-step guide will help get your database-driven ASP.NET web site up and running in no time..
subscribe
 
 
-->