Jump to content

Dynamic frames/buttons..


Michdd

Recommended Posts

I'm looping through a mysql result and I'm trying to create a frame for every loop named by $row['file_name'], then also create a button that will specifically change that frame. One of each of those for each entry obtained from the database. I have something like this (Google, just for the example)...

 

<iframe name="' . $row['file_name'] . '" frameborder="0" width="0" height="0" scrolling="no"></iframe>

<input type="button" value="" onclick="frames[\'' . $row['file_name'] .'\'].location.href=\'http://www.google.com\'" />

So it'll generate a bunch of frames a bunch of buttons. However every time I click one of the buttons it sends me to the top of my page, instead of just updating the frame.

Link to comment
https://forums.phpfreaks.com/topic/158064-dynamic-framesbuttons/
Share on other sites

Wow, that is one page I do not want to visit.

 

Just so you know, iFrames do not have a href attribute. Didn't Google tell you that?

There's no href attribute in my iframe. If you're talking about the button.. I've found this example here which does what I want, but it's not working.

 

http://www.cryer.co.uk/resources/javascript/script4.htm

 

No, but your JavaScript is trying to set a href attribute to it.

Then why does it work on the example in that website? And I've had something similar using the same thing working before, except it sends me to the top of the webpage after it's clicked.

 

Edit: It does set the frame, but it also sends me to the top of the page. Unlike in the example on that website I posted (near the bottom) Where it just loads the frame.

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.