iframe javascript problem

oracle

New Member
Messages
430
Reaction score
0
Points
0
Hello All,

I am having this problem.

I have a page main.html.

Inside that I have a page inside an iframe, frame.html.

Now I have some tabs in iframe, and for changing tabs i need to call few javascript functions within the frame itself.

In frame.html I have a javascript function, changetab() {} which is called upon when one clicks on a tab in the frame.html. However when I am clicking on the tabs I am getting changetab() not defined.

I am calling the function simply by the name, changetab().

Can someone tell me whats the problem is. I have little experience with iframes :(

Imoracle
 

Twinkie

Banned
Messages
1,389
Reaction score
12
Points
0
I had the same annoying problem. That is cause by some error in the JavaScript. Post it here and I will take a look at it =)
 

oracle

New Member
Messages
430
Reaction score
0
Points
0
main.html

<html>
<body>
<iframe height="200px" width="100px" src="frame.html" id="frame" name="frame" frameborder="0"></iframe>
</body>
</html>

and the frame.html is like this:

<html>
<head>
<script type="text/javascript">
function jump() {
alert("Hi");
}
</script>
</head>
<body>
<input type="submit" onclick="jump()" value="Click Me"/>
</body>
</html>

Its something like this. I am not trying to interact between the two frames at all. I just want the the iframe to call a function within itself normally.

Thanks in advance,
Imoracle
 

woiwky

New Member
Messages
390
Reaction score
0
Points
0
I don't see any problem with that code. I even just tested it and it works fine. It's better to post the exact code that you're using so that problems such as syntax errors can be identified.
 

phpasks

New Member
Messages
145
Reaction score
0
Points
0
main.html

<html>
<body>
<iframe height="200px" width="100px" src="frame.html" id="frame" name="frame" frameborder="0"></iframe>
</body>
</html>

and the frame.html is like this:

<html>
<head>
<script type="text/javascript">
function jump() {
alert("Hi");
}
</script>
</head>
<body>
<input type="submit" onclick="jump()" value="Click Me"/>
</body>
</html>

Its something like this. I am not trying to interact between the two frames at all. I just want the the iframe to call a function within itself normally.

Thanks in advance,
Imoracle

it is ok no problem in your page.
 

oracle

New Member
Messages
430
Reaction score
0
Points
0
I am sorry for the nuciance I created the other day. It was a silly mistake from my side, which was basically attaching a javascript file with type="text/css" thing in this. :(

A big blunder and I didnt cared to look at it while debugging,

Anyways thanks everyone for the help.

Imoracle
 
Top