Want to protect your cyber security and still get fast solutions? Ask a secure question today.Go Premium

x
?
Solved

window with map and text using js?

Posted on 2006-06-08
9
Medium Priority
?
169 Views
Last Modified: 2012-06-27
Hello Javascript experts;

Please take a look at script below:

function overviewWindow()
      {
            if (overviewMap!=null)
                  {
                  overviewMap.close()
                  }
            var myMap=getMap();
            var mySelection = myMap.getSelection();
            selkeys = new Array()
            var mapObjects = mySelection.getMapObjectsEx(null);
                  for (var i=0; i < mapObjects.size(); i++)
                  {
                        var myLayer = (mapObjects.item(i).getMapLayer().getName());
                        var mySelKeys = (mapObjects.item(i).getKey());
                        selkeys[i] = mySelKeys
                  }
            var theLat=getMap().getLat();
            var theLong=getMap().getLon();
            var theUnits=getMap().getUnits();
            var theWidth=getMap().getWidth(theUnits);
            var newWidth=(theWidth*2);
            var theFile="swissmap";
            overviewMap = window.open("templates/"+theFile+".mwf?LAT=" + theLat + "&LON=" + theLong + "&WIDTH=" + newWidth + "&UNITS=" + theUnits +"&TOOLBAR=off&LayersViewWidth=0&SELOBJS=" +myLayer + "," + selkeys+"&EXT=.MWF","overviewMap","toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=yes,resizable=yes,width=400,height=400");
      }

If I invoke the script above with this:
      <td>
     <a href="javascript:overviewWindow();">
     <img src="images/btn_av_off.gif" width="22" height="22" border="0" alt="Overview map."></a>
    </td>

a rectangular map opens up in a new window.

My question is this, is there a way that I can add additional text to the opened window so that I can have something like this:

Name:______________

Date:_______________

Location:____________

and the rectangular map will display at the bottom?

Is this possible?

Thanks in advance
0
Comment
Question by:simflex
  • 3
  • 2
  • 2
7 Comments
 
LVL 29

Expert Comment

by:Pravin Asar
ID: 16863580
overviewMap.document.body.onload = function () {  document.write ('Name : AAAAAAA'); }
0
 
LVL 11

Expert Comment

by:mvan01
ID: 16863600
Try invoking it like this:

     <td>
     <a href="javascript:overviewWindow();">
Name:______________<br><br>
Date:_______________<br><br>
Location:____________<br><hr>
     <img src="images/btn_av_off.gif" width="22" height="22" border="0" alt="Overview map."></a>
    </td>

Peace and joy.  mvan
0
 
LVL 11

Expert Comment

by:mvan01
ID: 16863621
:-P   d-:
... that a foolish response on my part.  sorry.  mvan
0
Concerto's Cloud Advisory Services

Want to avoid the missteps to gaining all the benefits of the cloud? Learn more about the different assessment options from our Cloud Advisory team.

 

Author Comment

by:simflex
ID: 16863668
Pretty quick response by use guys, thanks very much.

Unfortunately, none of them is working.

When I tried pravinasar's suggestion,

I get the following error:

"OverviewMap.document is null or not an object"

Just to be sure, this is how invoked Pravinasar's code.
      <td>
     <a href="javascript:overviewMap.document.body.onload = function () {  document.write ('Name : AAAAAAA'); }">
     <img src="images/btn_av_off.gif" width="22" height="22" border="0" alt="Overview map."></a>
    </td>


When I tried mvan's code, I get these:

Name:______________
Date:_______________
Location:____________

taking the place imagebutton.  However, when I clicked on it, I get the overview map without the name, date, location info
0
 
LVL 29

Expert Comment

by:Pravin Asar
ID: 16863797
Try this..


overviewMap = window.open("templates/"+theFile+".mwf?LAT=" + theLat + "&LON=" + theLong + "&WIDTH=" + newWidth + "&UNITS=" + theUnits +"&TOOLBAR=off&LayersViewWidth=0&SELOBJS=" +myLayer + "," + selkeys+"&EXT=.MWF","overviewMap","toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=yes,resizable=yes,width=400,height=400");


overviewMap.onload = function () {  document.write ('Name : AAAA'); };


0
 

Author Comment

by:simflex
ID: 16864015
Still getting:

"OverviewMap.document is null or not an object"

maybe it isn't possible?
0
 
LVL 29

Accepted Solution

by:
Pravin Asar earned 500 total points
ID: 16864136
Here is what I got as a test case,

Works with FF, not with IE yet.. trying to find out.

File : test.htm

<html>
<body>
<script language="javascript">
function AddText (nw) {
    nw.document.getElementById('name').innerHTML = 'Replaced Name';
      var dObj = document.createElement ('DIV');
    var text = document.createTextNode("New Name Text Appended");
    dObj.appendChild (text);
    if (document.all) { nw.document.body.appendChild (dObj); }
    else {     nw.document.body.appendChild (dObj);}
}
function OpenWindow() {
    var nw = window.open ('map.htm','nw','width=400, height=400');
    nw.onload = function () { AddText(nw); }
    return false;
}
</script>
<a href="#" onclick="return OpenWindow();">Open </a>
</body>
</html>


File : map.htm

<html>
<body>
<img  src="../images/banner1.gif">
<p>***Name : <span id="name">Name Goes Here</span>
<br/>
</body>
</html>
0

Featured Post

Concerto Cloud for Software Providers & ISVs

Can Concerto Cloud Services help you focus on evolving your application offerings, while delivering the best cloud experience to your customers? From DevOps to revenue models and customer support, the answer is yes!

Learn how Concerto can help you.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Introduction HTML checkboxes provide the perfect way for a web developer to receive client input when the client's options might be none, one or many.  But the PHP code for processing the checkboxes can be confusing at first.  What if a checkbox is…
The task A number given should be formatted for easy reading by separating digits into triads. Format must be made inline via JavaScript, i.e., frameworks / functions are not welcome. So let’s take a number like this “12345678.91¿ and format i…
The viewer will learn the basics of jQuery, including how to invoke it on a web page. Reference your jQuery libraries: (CODE) Include your new external js/jQuery file: (CODE) Write your first lines of code to setup your site for jQuery.: (CODE)
The viewer will learn the basics of jQuery including how to code hide show and toggles. Reference your jQuery libraries: (CODE) Include your new external js/jQuery file: (CODE) Write your first lines of code to setup your site for jQuery…
Suggested Courses

579 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question