473,804 Members | 3,353 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

help in document.open

parshupooja
159 New Member
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

Expand|Select|Wrap|Line Numbers
  1. StringBuilder str = new StringBuilder();
  2.                             str.Append("<script type=text/javascript>");
  3.                             str.Append("function replace(){");
  4.                             str.Append("window.alert('HH');");
  5.                             str.Append("var oNewDoc = document.open('text/html', 'replace');");
  6.                             str.Append(" var sMarkup='");
  7.                             str.Append("<html>");
  8.                             str.Append("<head>");
  9.                             str.Append("<script language=javascript src=http://api.maps.yahoo.com/ajaxymap?v=3.0&appid=Demo>");
  10.                             str.Append("</script>");
  11.                             str.Append("</head>");
  12.                             str.Append("<body>");
  13.                             str.Append("<div id='mapContainer'></div>");
  14.                             str.Append("<script type=text/javascript>");
  15.                             str.Append("ymap.addPanControl();");
  16.                             str.Append("ymap.addZoomLong();");
  17.                             str.Append("ymap.addTypeControl();");
  18.                             str.Append("ymap.drawZoomAndCenter(60601, 6);");
  19.                             str.Append("function createYahooMarker(customer, address, num) {");
  20.                             str.Append("  var myImage = new YImage();");
  21.                             str.Append("  myImage.src = 'http://us.i1.yimg.com/us.yimg.com/i/us/map/gr/mt_ic_c.gif';");
  22.                             str.Append("  myImage.size = new YSize(20,20);");
  23.  
  24.                             str.Append("  myImage.offsetSmartWindow = new YCoordPoint(0,0);");
  25.  
  26.                             str.Append("  var marker = new YMarker("+address+", myImage);");
  27.  
  28.                              str.Append("var swtext = "+customer + "<br>" + address+";");
  29.                              str.Append("var label = num;");
  30.                              str.Append("marker.addLabel(label);");
  31.                              str.Append("YEvent.Capture(marker, EventsList.MouseClick, function() { marker.openSmartWindow(html) });");
  32.  
  33.                             str.Append("return marker;");
  34.                             str.Append("}");
  35.                             str.Append("var Marker" + i + " = createYahooMarker("+customer+"," + address + ","+order+");");
  36.  
  37.  
  38.  
  39.                             str.Append("ymap.addOverlay(Marker" + i + ");");
  40.  
  41.                             i = i + 1;
  42.                             str.Append("</script>");
  43.                             str.Append("</body>");
  44.                             str.Append("</html>;'");
  45.                             str.Append("oNewDoc.write(sMarkup);");
  46.                             str.Append("oNewDoc.close();");
  47.                             str.Append("}");
  48.                             str.Append("</script>");
please help
Jan 10 '08 #1
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.
Jan 11 '08 #2

Sign in to post your reply or Sign up for a free account.

Similar topics

2
3561
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 ?
5
2296
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. ...
2
3908
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...
8
1657
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
2
1150
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');
33
2476
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">
0
5578
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
5
3702
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?
7
2375
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...
2
1635
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
0
9591
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,...
0
10594
Oralloy
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...
1
10331
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,...
0
9166
agi2029
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...
0
5529
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...
0
5667
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
4306
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
2
3831
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
3001
bsmnconsultancy
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...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.