Jump to content


New Members
  • Content Count

  • Joined

  • Last visited

Community Reputation

0 Neutral

About jamfitz001

  • Rank
  1. I'm adapting some straightup examples of Drag / Drop from W3school. Everything seems to work with other Browsers as expected. IE is not working. I have an HTML object on my page: <div id="1717" class="mydrag_obj" draggable='true' ondragstart='func_dragstart(event)'> <a href="https://www.yahoo.com" target="_blank"> <div class="row_1"></div> <div class="row"_2"></div> </a></div> JavaScript: func_dragstart(ev) { ev.dataTransfer.setData("text/plain", ev.target.id);} When I drop - func_dropped_dropzone (ev) { ev.preventDefault(); alert ('card_id- ' + ev.dataTransfer.getData("text")); return true; } For all browsers ev.dataTransfer.getData("text")) ...the alert = card_id=1717 but for IE the alert = card_id="https://www.yahoo.com" can someone explain what I need to do to make IE return the ID of the DIV?
  2. Hi. Thanks for reading. I am looking for an explanation of how to treat a Link to a website when I capture it as a input field. I have an input text field Link: ................... The profile creator can type in an HTML link "http://www.yahoo.com". ( Or a more complex link, possibly to his Facebook page, or Instagram or Twitter.) Once she types it in and submits it, Javascript reads the input and saves it as variable which is passed to PHP where it is saved in a MySQl column. On the user page, this link will then be read from the database and echoed out as an <a> anchor tag around the profile, allowing others to cllick on the link and direct the end user to the site added by profile creator. Can someone please spell out what steps I should take? 1. What validation on the quality of the link be done? (if the user typed in 'Hello World'....can I detect this and reject it?) Can I test that it starts with HTTP:, etc. Any ideas appreciated. 2. I assume javascript should then capture the link with encodeURI()? 3. On the PHP side, I will have the encoded URI...Can that be written directly to the MYSQL? Will PHP urldecode() suffice to recreate the string when it is echoed as an <a> tag? Thanks for your feedback, or any pointing to a good explanation or reference!
  3. I am not using a framework. I am not an overly experienced WAMP programmer. I am working on a personal project. I have a DIV ID='contents' and on page load, there is an js function that does an AJAX call to PHP/MYSQL and this echoes a set of DIVs, class='members' ID=$member_id, that are returned as innerHTML of Div ID='contents' . These members DIVs are all draggable. Outside of DIV ID='contents' is a Div that is a dropzone. The dropzone onDrop runs a javascript function that does an AJAX call to a different PHP/MYSQL page. When I drag a member and drop it on the dropzone, the list of member DIVs disappears from the web page. ( Div ID='contents' innerHTML is empty) The Drop function is not meant to affect the innerHTML of Div ID='contents' , it simply returns a message to the dropzone's innerHTML. Why does the drop impact the 'contents' DIV at all? How can I prevent this from happening? (The drag and drop functions are all examples off of W3school tutorials..nothing fancy). function Func_card_dragstart_handler(ev) { console.log("dragStart"); // Add the target element's id to the data transfer object ev.dataTransfer.setData("text/plain", ev.target.id); } function allow_drop_dropzone(ev) { ev.preventDefault();} function func_dropped_dropzone (ev) { ev.preventDefault(); var member_id = ev.dataTransfer.getData("text"); if (document.getElementById('show_loc').checked ) {request_type = 'A';} else {request_type = 'D';} request_key = document.getElementById('mbr_id').value; // Setup the AJAX call var url= 'process_mbr.php';var rnd982g = Math.random(); var passvars = '?card_id=' + member_id + '&mbr_id=' + request_key + '&r_type=' + request_type + '&rnd982g=' + rnd982g; if(vbcReq.readyState == 4 || vbcReq.readyState == 0) { vbcReq.open('GET',url + passvars,'true'); vbcReq.onreadystatechange = member_updated; vbcReq.send(null); } return true; } function member_updated() { document.getElementById('d400_d').innerHTML = vbcReq.responseText; return true; } This the first question I've asked...so hope that I have been clear and followed protocols.
  • 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.