Jump to content

jamfitz001

New Members
  • Posts

    3
  • Joined

  • Last visited

jamfitz001's Achievements

Newbie

Newbie (1/5)

0

Reputation

  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!
×
×
  • 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.