PcGeniusProductions Posted March 29, 2009 Share Posted March 29, 2009 OK, I know this aint PHP, but I don't know where else to go, and I am sure I am missing something stupidly simple here... Look at the following code, logically it should work perfectly fine... <form target="editor" onsubmit="this.action=this.goTo.value"> <input type="text" name="goTo"> <input type="submit" name="submit" value="submit"> </form> <a target="editor" href="javascript:document.body.contentEditable='true'; document.designMode='on'; void 0">edit</a> <iframe src="" id="editor" name="editor" border="0" frameborder="0" width="100%" height="500"></iframe> But it doesn't! Any ideas? I am trying to let a user enter their desired URL, which then loads in the iframe. That works fine, but then when I try to let them edit it with the link, it failes. Using the direct javascript on the parent page works fine, so why not in the target="editor" ? Quote Link to comment https://forums.phpfreaks.com/topic/151572-simple-script-please-advise-me/ Share on other sites More sharing options...
MadTechie Posted March 29, 2009 Share Posted March 29, 2009 You know its not PHP yet you posted here! doesn't sounds logical! Quote Link to comment https://forums.phpfreaks.com/topic/151572-simple-script-please-advise-me/#findComment-796059 Share on other sites More sharing options...
PcGeniusProductions Posted March 29, 2009 Author Share Posted March 29, 2009 Hmm, and I am under the illusion that these forums are here to distribute knowledge and support between its members... These are "support" forums not "snide" forums, and pardon me for pointing out the obvious but out of the two the post you submitted was far from support! That, to me, doesn't sound logical! Quote Link to comment https://forums.phpfreaks.com/topic/151572-simple-script-please-advise-me/#findComment-796199 Share on other sites More sharing options...
chmpdog Posted March 29, 2009 Share Posted March 29, 2009 logically speaking, this code should work. What errors are you getting? PS: There is a html section somewhere on this forum Quote Link to comment https://forums.phpfreaks.com/topic/151572-simple-script-please-advise-me/#findComment-796246 Share on other sites More sharing options...
RichardRotterdam Posted March 29, 2009 Share Posted March 29, 2009 You know its not PHP yet you posted here! doesn't sounds logical! Hmm, and I am under the illusion that these forums are here to distribute knowledge and support between its members... These are "support" forums not "snide" forums, and pardon me for pointing out the obvious but out of the two the post you submitted was far from support! That, to me, doesn't sound logical! MadTechie commented that because you posted your thread under "PHP help" Instead of "Javascript Help". If you know you want javascript help it should be logically posted under Javascript. What exactly is error you recieve. And is there any reason not to use php for this? Simply using a php form to post values would be easier. If you do want to go the javascript you'll have to prevent the form from getting submitted and only refresh part of the Page. Quote Link to comment https://forums.phpfreaks.com/topic/151572-simple-script-please-advise-me/#findComment-796255 Share on other sites More sharing options...
PcGeniusProductions Posted March 29, 2009 Author Share Posted March 29, 2009 I am a real coding rookie, and this is one of my first unique ideas which I actually am trying to build... The idea is to allow a user to enter a URL of their desired page, then once loaded (in the iframe) they can edit it in their browser. It's only a toy, but I think it would be cool. I am not exactly receiving errors, It just simply dont work. I have not tried it on my server yet, as with it being JS/HTML, it should work perfectly fine client-side. The page loads perfectly fine in the iframe, but when you click "edit" nothing happens. And yeah I agree, I shouldn't have posted in a PHP Section, I just wasn't aware of any HTML section, I found that just now. If there is a PHP Method of doing this, it would be much better in terms of compatibility and security, as it is a slight pain allowing users to View Source and take my code. Thanks in advance for any help offered Quote Link to comment https://forums.phpfreaks.com/topic/151572-simple-script-please-advise-me/#findComment-796270 Share on other sites More sharing options...
MadTechie Posted March 29, 2009 Share Posted March 29, 2009 Hmm, and I am under the illusion that these forums are here to distribute knowledge and support between its members... These are "support" forums not "snide" forums, and pardon me for pointing out the obvious but out of the two the post you submitted was far from support! That, to me, doesn't sound logical! Using your own logic you might as well post the same question in any support section of any site! however your probably notice that all these site (including this one) have rules. Pick the right forum for your question. If you have a Database-only question' date=' post in the database section (MySQL/etc). If you have an OOP question, post in the OOP board. If your question doesn't relate to programming, post in the Misc board. We've also turned off polls in most boards. If you have a question that requires a poll, post it in the Polls board.[/quote'] Why do we have these rules, you may ask? Well its to make life easier, for members to find related problems and so other members who know that subject to be able to help. Quote Link to comment https://forums.phpfreaks.com/topic/151572-simple-script-please-advise-me/#findComment-796279 Share on other sites More sharing options...
RichardRotterdam Posted March 29, 2009 Share Posted March 29, 2009 The idea is to allow a user to enter a URL of their desired page, then once loaded (in the iframe) they can edit it in their browser. It's only a toy, but I think it would be cool. That does sound similar to what greasemonkey for firefox does though. as for loading an url into an iframe using only php you could use: <form action="form_name_here.php" method="post"> <input type="text" name="url" /> <input type="submit" name="submit" value="submit" /> </form> <?php if(isset($_POST['submit']) && $_POST['url']!=""){ echo("<iframe src=\"{$_POST['url']}\"></iframe>"); } ?> it's not tested btw If you are going to use something like that it's very likely that you are going to run into crosssite scripting issues. Quote Link to comment https://forums.phpfreaks.com/topic/151572-simple-script-please-advise-me/#findComment-796281 Share on other sites More sharing options...
PcGeniusProductions Posted March 29, 2009 Author Share Posted March 29, 2009 DJ Kat: Thanks for your help. I will try this now. MadTechie: I stand corrected! Remember... "Support" forum Try meditating a little Quote Link to comment https://forums.phpfreaks.com/topic/151572-simple-script-please-advise-me/#findComment-796291 Share on other sites More sharing options...
darkfreaks Posted March 29, 2009 Share Posted March 29, 2009 Fixed your script was missing semi colons: <form target="editor" onsubmit="this.action=this.goTo.value;"> <input type="text" name="goTo"> <input type="submit" name="submit" value="submit"> </form> <a target="editor" href="javascript:document.body.contentEditable='true'; document.designMode='on'; void 0;">edit</a> <iframe src="" id="editor" name="editor" border="0" frameborder="0" width="100%" height="500"></iframe> Quote Link to comment https://forums.phpfreaks.com/topic/151572-simple-script-please-advise-me/#findComment-796389 Share on other sites More sharing options...
PcGeniusProductions Posted March 29, 2009 Author Share Posted March 29, 2009 Hi darkfreaks. Yeah I noticed that a lil earlier, but even so, it does not work. Nevermind, I have given up on the code anyway, it was only ever a toy, and I have more important things to worry about than this. Maybe when I am bored outta my head with nothing better to do, I will try again. Thanks to everyone here who tried to help, I am grateful for that. Quote Link to comment https://forums.phpfreaks.com/topic/151572-simple-script-please-advise-me/#findComment-796473 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.