Hey All,
I am working in asp.net c# and Javascript. I building javascript dynamically.
Actually When user click on button I want new window to open with Yahoo map. If I want map with in a page it works fine. In order to display map in new html page I am using document.open and It seems i have someerror.
Could anyone helpin fixing a bug
here is my code - StringBuilder str = new StringBuilder();
-
str.Append("<script type=text/javascript>");
-
str.Append("function replace(){");
-
str.Append("window.alert('HH');");
-
str.Append("var oNewDoc = document.open('text/html', 'replace');");
-
str.Append(" var sMarkup='");
-
str.Append("<html>");
-
str.Append("<head>");
-
str.Append("<script language=javascript src=http://api.maps.yahoo.com/ajaxymap?v=3.0&appid=Demo>");
-
str.Append("</script>");
-
str.Append("</head>");
-
str.Append("<body>");
-
str.Append("<div id='mapContainer'></div>");
-
str.Append("<script type=text/javascript>");
-
str.Append("ymap.addPanControl();");
-
str.Append("ymap.addZoomLong();");
-
str.Append("ymap.addTypeControl();");
-
str.Append("ymap.drawZoomAndCenter(60601, 6);");
-
str.Append("function createYahooMarker(customer, address, num) {");
-
str.Append(" var myImage = new YImage();");
-
str.Append(" myImage.src = 'http://us.i1.yimg.com/us.yimg.com/i/us/map/gr/mt_ic_c.gif';");
-
str.Append(" myImage.size = new YSize(20,20);");
-
-
str.Append(" myImage.offsetSmartWindow = new YCoordPoint(0,0);");
-
-
str.Append(" var marker = new YMarker("+address+", myImage);");
-
-
str.Append("var swtext = "+customer + "<br>" + address+";");
-
str.Append("var label = num;");
-
str.Append("marker.addLabel(label);");
-
str.Append("YEvent.Capture(marker, EventsList.MouseClick, function() { marker.openSmartWindow(html) });");
-
-
str.Append("return marker;");
-
str.Append("}");
-
str.Append("var Marker" + i + " = createYahooMarker("+customer+"," + address + ","+order+");");
-
-
-
-
str.Append("ymap.addOverlay(Marker" + i + ");");
-
-
i = i + 1;
-
str.Append("</script>");
-
str.Append("</body>");
-
str.Append("</html>;'");
-
str.Append("oNewDoc.write(sMarkup);");
-
str.Append("oNewDoc.close();");
-
str.Append("}");
-
str.Append("</script>");
please help
1 1409 acoder 16,027
Recognized Expert Moderator MVP
Use window.open() instead.
document.open() opens the current document, not a new one.
As a full member now, you should know that we expect your code to be posted in [code] tags (See How to Ask a Question).
This makes it easier for our Experts to read and understand it. Failing to do so creates extra work for the moderators, thus wasting resources, otherwise available to answer the members' questions.
Please use the tags in future.
MODERATOR.
Sign in to post your reply or Sign up for a free account.
Similar topics |
by: fabien |
last post by:
Hi,
I am writing a POV-RAY editor with Python using either QT or GTK as GUI
'wrapper'. ( I am still trying both )
* * * * PYGTK * * * *
I have downloaded PygtkScintilla-1.99.5.
There is a lexPOV.cxx file in the package, but I can not find any POV
keywords in any file ( there are about 150 POV keywords). Did i miss it,
and if not, how do I create one and include it for the library building ?
|
by: TrvlOrm |
last post by:
Can any one please help me...I am new to JavaScript and I have been
struggling with this code for days now and can't figure it out.
I would like to get the Buttons to correspond with the action to
either a) generate numbers b) Prompts a user to locate a web page c)
go to previous page in history list d) Loads next page in history list
e) Promps the user for a URL and loads the web page in a new window f)
and Re-Sizes the window.
...
|
by: Jackson Yap |
last post by:
can someone kind enough to help me look at the attached html and js
file? Why is it that the javascript menu could not work at
www.apchosting.net but could work at
http://home.pacific.net.sg/~jacksony ? (the drop down bar could not work
at www.apchosting.net but can drop at home.pacific.net.sg. I suspect it
is a server problem but was told it is not possible, therefore assuming
it is a client script problem? the script works last time...
|
by: Donius |
last post by:
Hello!
I've been headhunting for a javascript popup that i saw once, that when
it's called, pops open and grows from the center to its desired h and
w. Does anyone have any idea where i could start on this one? Haven't
found through googling or list searching.
Thanks!
-Brendan
|
by: syedfazalullah |
last post by:
Hi,
Is there any one who could help me to execute the following code
correctly.
<html>
<head>
<title>Some Title</title>
<script>
win=window.open('',null,'height=300,width=700');
| |
by: Todd |
last post by:
OK,
I created a .htm page within a new Web solution:
--------------------------------------------------------
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<html>
<head>
<title>Menu</title>
<meta name=vs_defaultClientScript content="JavaScript">
|
by: gunimpi |
last post by:
http://www.vbforums.com/showthread.php?p=2745431#post2745431
********************************************************
VB6 OR VBA & Webbrowser DOM Tiny $50 Mini Project Programmer help
wanted
********************************************************
For this teeny job, please refer to:
http://feeds.reddit.com/feed/8fu/?o=25
|
by: althafexcel |
last post by:
hi everyone
Im trying to include an external js in my aspx page under the head
tag, it doesn't load or it displays an object expected error whenver
the function from the .js is called. Actually for repeated html im
using the external js, i mean the TOP, BOTTOM they are repeated in
every page, so i include them as functions in the external js and call
them. Why it doesn't work?
|
by: gubbachchi |
last post by:
Hi all,
In my application I need to display the data fetched from mysql database after the user selects date from javascript calender. I have written the code in which after the user selects the date from calender and clicks search button it will fetch data from database. But what I need is as soon the user clicks the date, it should fetch data for that date from database. How to do it. Here is the code I am using
<html>
<script...
|
by: registry |
last post by:
<%@Language="VBSCRIPT" CODEPAGE="1252"%>
<html>
<head>
<title>Registry Network Hospital Detail</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<script language="JavaScript" type="text/JavaScript">
<!--
function MM_reloadPage(init) { //reloads the window if Nav4 resized
|
by: Hystou |
last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it.
First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
| |
by: Oralloy |
last post by:
Hello folks,
I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>".
The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed.
This is as boiled down as I can make it.
Here is my compilation command:
g++-12 -std=c++20 -Wnarrowing bit_field.cpp
Here is the code in...
|
by: Hystou |
last post by:
Overview:
Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
|
by: agi2029 |
last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own....
Now, this would greatly impact the work of software developers. The idea...
|
by: TSSRALBI |
last post by:
Hello
I'm a network technician in training and I need your help.
I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs.
The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols.
I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
|
by: adsilva |
last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
|
by: 6302768590 |
last post by:
Hai team
i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
| |
by: muto222 |
last post by:
How can i add a mobile payment intergratation into php mysql website.
|
by: bsmnconsultancy |
last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...
| |