Michdd Posted May 14, 2009 Share Posted May 14, 2009 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 More sharing options...
Ken2k7 Posted May 14, 2009 Share Posted May 14, 2009 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? Link to comment https://forums.phpfreaks.com/topic/158064-dynamic-framesbuttons/#findComment-833778 Share on other sites More sharing options...
Michdd Posted May 14, 2009 Author Share Posted May 14, 2009 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 Link to comment https://forums.phpfreaks.com/topic/158064-dynamic-framesbuttons/#findComment-833780 Share on other sites More sharing options...
Ken2k7 Posted May 14, 2009 Share Posted May 14, 2009 No, but your JavaScript is trying to set a href attribute to it. Link to comment https://forums.phpfreaks.com/topic/158064-dynamic-framesbuttons/#findComment-833783 Share on other sites More sharing options...
Michdd Posted May 14, 2009 Author Share Posted May 14, 2009 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. Link to comment https://forums.phpfreaks.com/topic/158064-dynamic-framesbuttons/#findComment-833784 Share on other sites More sharing options...
Ken2k7 Posted May 14, 2009 Share Posted May 14, 2009 Wow, I guess it works both ways. Didn't know that. I apologize. Link to comment https://forums.phpfreaks.com/topic/158064-dynamic-framesbuttons/#findComment-833785 Share on other sites More sharing options...
Michdd Posted May 14, 2009 Author Share Posted May 14, 2009 So does anyone have an idea why it reloads me to the top of the page? Link to comment https://forums.phpfreaks.com/topic/158064-dynamic-framesbuttons/#findComment-834251 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.