markstephenson Posted January 21, 2007 Share Posted January 21, 2007 Im sure this will be a php/mysql/javascript answer, but i think the clever stuff will have to be done in Javascript...What I am wanting to do is have 2 frames, one containing some navigation stuff, one containing the main site displayed. What i am looking to do is automatically check the page which is loaded (read the html) and allow me to use the right click (custom context menu?) on hrefs and images within hfrefs to send their value to a database.Is this even possible? is there a better way of doing it?Many thanks Quote Link to comment https://forums.phpfreaks.com/topic/35124-link-changing-on-the-fly/ Share on other sites More sharing options...
bibby Posted January 22, 2007 Share Posted January 22, 2007 There are a lot of things that you need to look into separately, but nothing you have asked for seems impossible:[quote]Im sure this will be a php/mysql/javascript answer, but i think the clever stuff will have to be done in Javascript...[/quote] Yeah, if the side frame is never to refresh, but remain aware of it's changing surroundings, then javasctipt is the answer.[quote]What I am wanting to do is have 2 frames, one containing some navigation stuff, one containing the main site displayed. [/quote] [i]meh[/i], I don't like that you're using frames, but it should work. The reason why I say so is that you'll need some ajax anyway for your context menu, so why not refetch the whole display frame? [quote]What i am looking to do is automatically check the page which is loaded (read the html) and allow me to use the right click (custom context menu?) on hrefs and images within hfrefs to send their value to a database.[/quote] Sending values without refreshing will need some ajax. This expects some sort of return (which is the new context menu?), or a brand new display frame. You can set events to fire on right-click , but mac users might hate you. To have the left-frame aware of what's going on, research setAttribute() & getAttribute(), or use a dummy input to store the filename clicked:[code]<script>function addToBucket(url){ document.getElementById('bucket').value=url; // or whatever.setAttribute('active')=url; //now do things according to plan processChanges();}function fetchFromBucket(){ return document.getElementById('bucket').value; // or whatever.getAttribute('active');}function processChanges(){ var activeUrl = fetchFromBucket(); /** // do whatever you need to based on this condition **/}</script><input type="hidden" id="bucket"><a href="file1.php" onclick="addToBucket(this.href);"><a href="file2.php" onclick="addToBucket(this.href);">[/code] Quote Link to comment https://forums.phpfreaks.com/topic/35124-link-changing-on-the-fly/#findComment-165956 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.