Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    text
    copied!<p>It has to do with your browser's popup blocker. If you look closely at the error, it's describing the submit "button" as the problem, not the mapValue.input line.</p> <p>The below code is working for me:</p> <p><a href="http://jsfiddle.net/WDFNL/" rel="noreferrer">http://jsfiddle.net/WDFNL/</a></p> <pre><code>function openMapWindow (data) { alert(data); var mapForm = document.createElement("form"); mapForm.target = "Map"; mapForm.method = "POST"; // or "post" if appropriate mapForm.action = "/map.php"; var mapInput = document.createElement("input"); mapInput.type = "text"; mapInput.name = "addrs"; mapInput.value = data; mapForm.appendChild(mapInput); document.body.appendChild(mapForm); window.open("", "Map", "status=0,title=0,height=600,width=800"); mapForm.submit(); } openMapWindow('-35.308401,149.124298-35.307841,149.124298'); </code></pre> <p>I did get the error you're describing at first, but it had to do with my popup blocker. Once I authorized jsfiddle.net to be allowed popups, it started working.</p> <p><strong>EDIT</strong></p> <p>There is an easy way to test for this and alert the user if their popup blocker is disabling the map:</p> <p><a href="http://jsfiddle.net/WDFNL/1/" rel="noreferrer">http://jsfiddle.net/WDFNL/1/</a></p> <pre><code>function openMapWindow (data) { var mapForm = document.createElement("form"); mapForm.target = "Map"; mapForm.method = "POST"; // or "post" if appropriate mapForm.action = "/map.php"; var mapInput = document.createElement("input"); mapInput.type = "text"; mapInput.name = "addrs"; mapInput.value = data; mapForm.appendChild(mapInput); document.body.appendChild(mapForm); map = window.open("", "Map", "status=0,title=0,height=600,width=800"); if (map) { mapForm.submit(); } else { alert('You must allow popups for this map to work.'); } } openMapWindow('-35.308401,149.124298-35.307841,149.124298'); </code></pre> <p>Note the <code>map</code> variable. You can test it to see if <code>window.open</code> returned a window handle, and act accordingly depending on the result.</p>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload