Thanks I am now looking at the code and trying to understand it![]()
Thanks I am now looking at the code and trying to understand it![]()
I was just giving you examples. None of that in particular is meant to do anything. Except of course the div. That you can paste a link like you were talking about into, and then access it like from a textarea you would use its.valueproperty, for the div, you need its.innerHTMLproperty.
Perhaps this would have been a better demo:
Code:<!DOCTYPE html> <html> <head> <title></title> <meta http-equiv="Content-Type" content="text/html; charset=utf-8"> <style type="text/css"> #input { width: 500px; height: 400px; border: 1px solid black; } </style> </head> <body> <div id="input" contenteditable></div> <input type="button" value="Get Content" onclick="alert(document.getElementById('input').innerHTML);"> </body> </html>
Last edited by jscheuer1; 06-08-2016 at 09:35 PM. Reason: add simplified/enhanced demo
- John________________________
Show Additional Thanks: International Rescue Committee - Donate or: The Ocean Conservancy - Donate or: PayPal - Donate
Perhaps even better:
Code:<!DOCTYPE html> <html> <head> <title></title> <meta http-equiv="Content-Type" content="text/html; charset=utf-8"> <style type="text/css"> #input { width: 500px; height: 400px; border: 1px solid black; } </style> <script type="text/javascript"> function linkinfo(){ var response = '', links = document.getElementById('input').getElementsByTagName('a'), linknum = links.length, alink = -1, thelink; if(linknum){ while((thelink = links[++alink])){ response += 'Link #' + (alink + 1) + ':\n\xa0\xa0\xa0\xa0\xa0href: ' + thelink.href + '\n\xa0\xa0\xa0\xa0\xa0html: ' + thelink.innerHTML + '\n'; } } else { response = "No links currently in the input div." } alert(response); } </script> </head> <body> <div id="input" contenteditable></div> <input type="button" value="Get Content" onclick="alert(document.getElementById('input').innerHTML);"><br> <input type="button" value="Get Link Info" onclick="linkinfo();"> </body> </html>
- John________________________
Show Additional Thanks: International Rescue Committee - Donate or: The Ocean Conservancy - Donate or: PayPal - Donate
Bookmarks