SitePoint Sponsor |
|
User Tag List
Results 1 to 2 of 2
Thread: Iframes - Javascript PHP issue
-
Oct 21, 2005, 17:42 #1
- Join Date
- Oct 2005
- Posts
- 1
- Mentioned
- 0 Post(s)
- Tagged
- 0 Thread(s)
Iframes - Javascript PHP issue
Hi there! This is my first post, so go easy on me!
I have a website that uses iframes for information that scrolls. I use a mouseover script that allows me to use scroll bar up and down images, which scrolls the contents of the iframe.
This worked like a charm pulling in html pages. I changed the link (and that is all I did - from /webpage.html to http://www.webpage.php ) to an outside page that is php. The iframe still pulls in the page, but my mouseover scroll bars are frozen. So the user cannot scroll to see the content of the iframe anymore.
I am wondering if my scroll.js script needs an addition to make it compatible for php as well as html. I am just guessing here, as I am not a coder myself.
Have a look:
// JavaScript Document
function startDiv(dir)
{
y = 1; //amount to jump by
x = 0;
delay = 10; //speed in milliseconds
moving = window.setInterval("scrollDiv("+x+","+y+","+dir+")",delay);
return true;
}
function speedDiv(dir)
{
y = 5; //amount to jump by
x = 0;
delay = 1; //speed in milliseconds
speedmoving = window.setInterval("scrollDiv("+x+","+y+","+dir+")",delay);
return true;
}
function scrollDiv(x,y,dir)
{
if (dir == 1)
{
self.frames["myiframe"].scrollBy (x,-y);
}
else
{
self.frames["myiframe"].scrollBy (x,y);
}
}
function stopSpeedDiv()
{
if (speedmoving)
{
window.clearInterval(speedmoving);
}
}
function stopDiv()
{
if (moving)
{
window.clearInterval(moving);
}
}
___________________________
Just for reference, here is the mouseover script:
<a href="#" onMouseOver="startDiv(1);" onMouseOut="stopDiv();MM_swapImgRestore();" onMouseDown="speedDiv(1);" onMouseUp="stopSpeedDiv();" onClick="return false;"><img src="images/arrow_up.gif" alt="" width="30" height="22" border="0"></a>
<a href="#" onMouseOver="startDiv(2);" onMouseOut="stopDiv();MM_swapImgRestore();" onMouseDown="speedDiv(2);" onMouseUp="stopSpeedDiv();" onClick="return false;"><img src="images/arrow_down.gif" alt="" width="30" height="22" border="0"></a>
_____________________________________
Here is the iframes code:
<iframe src="http://www.website.com/folder/webpage.php" name="myiframe" scrolling="no" frameborder="0" class="maintxt" style="width: 345px; height: 299px;">
______________________________________
To note, I realize that I can say scrolling 'yes' on the iframe and get one of the ugly scroll bars to appear. Already solved that for the html page that got called into the iframe so I could use my own images for the scroll up and down functions, instead of the ugly scroll bars. All I need is for it to work with this URL with php extension.
If that is possible.
Thanks in advance for your help.
-
Oct 21, 2005, 19:09 #2
- Join Date
- Mar 2001
- Posts
- 3,537
- Mentioned
- 0 Post(s)
- Tagged
- 0 Thread(s)
I am wondering if my scroll.js script needs an addition to make it compatible for php as well as html.
Javascript has certain security restrictions. One of which is, if you have a page from some domain other than yours that you load into an iframe, you can't do much to the page. You could be bumping up against those security restrictions with your custom scroll bar script.
I am just guessing here, as I am not a coder myself.
"Please don't bother explaining what's wrong with my script because I don't know anything about javascript, so I won't be able to understand what you are talking about. Just fix it."
Generally, you are not going to get any responses to that unless you add,
"I'm willing to hire a js coder for $50/hr to fix it."
Bookmarks