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
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=

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

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