Jump to content

need javascript in html string


clausowitz

Recommended Posts

I have a script that will display a google map on my form.

The lat and lon for the google map are stored in a hidden textbox.

I use a javascript to retrieve the value of the textbox:

 

<script type="text/javascript">document.getElementById('MyTextBox').value</script>

 

Now I want to use this value, which is something like `30.123456, 29.123456` in the string:

 

<div align="right" style="padding:4px; background-color:#D2F0D3;"><a href="#" onclick="return false" onmousedown="javascript:toggleViewMap('google_map');">close map</a></div>

<iframe width="550" height="300" frameborder="0" scrolling="no" marginheight="0" marginwidth="0" src="http://maps.google.com/maps/api/staticmap?center='<?php echo ("javascript:document.getElementById('MyTextBox').value"); ?>'&zoom=12&markers=color:red|label:B|'<?php echo ("javascript:document.getElementById('MyTextBox').value"); ?>'&size=550x300&sensor=false">">'</iframe>

<div align="left" style="padding:4px; background-color:#D2F0D3;"><a href="#" onclick="return false" onmousedown="javascript:toggleViewMap('google_map');">close map</a></div>

    </div>

 

This code doesn´t return the values, what is wrong?

 

Marco

Link to comment
https://forums.phpfreaks.com/topic/242150-need-javascript-in-html-string/
Share on other sites

I created a javascript session variable±

 

function change(x) {

 

    sessvars.grid = document.getElementById(x).alt;

 

}

 

Now I want to pass the variable to the url but it doesn´t work±

 

<div align="right" style="padding:4px; background-color:#D2F0D3;"><a href="#" onclick="return false" onmousedown="javascript:toggleViewMap('google_map');">close map</a></div>

<iframe width="550" height="300" frameborder="0" scrolling="no" marginheight="0" marginwidth="0" src="http://maps.google.com/maps/api/staticmap?center='+sessvars.grid&zoom=12&markers=color:red|label:B|'+sessvars.grid&size=550x300&sensor=false">"></iframe>

<div align="left" style="padding:4px; background-color:#D2F0D3;"><a href="#" onclick="return false" onmousedown="javascript:toggleViewMap('google_map');">close map</a></div>

    </div>

 

Any thought=

Archived

This topic is now archived and is closed to further replies.

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