473,657 Members | 2,592 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Write javascript 'into' a c# .NET webapplikation

Nat
Help, I have following code:

-----------------------------------------------------

protected override void Render(HtmlText Writer w)
{
if (helpString!=nu ll)
{
w.write("<span class='tooltipi conouter'><img title =
'"+this.helpStr ing+"' class='tooltipI conInner' align='center' src =
'../Lib/images/questionmark.gi f' a href='#' onclick = 'myWin =
window.open(); myWin.document. write(\"" +helpString+
"\")'></a></span>");
}

-----------------------------------------------------

I want to add some parameters in to the window.open() or in the
document.write( ), så I can control the window size, bg. color and name
-
how do I write that into the code above??

(If I fx. write: window.open('', 'Something','wi dth=200 height'),
depending on where I put it in, it either doesn't open a new window,
or it reseizes the image).

Thanks
Nov 15 '05 #1
4 3616
I suggest you rewrite it a bit, like so:

protected override void Render(HtmlText Writer w)
{
if (helpString!=nu ll)
{
w.write(
"<span class='tooltipi conouter'>" +
"<img title=\"" + this.helpString +
"\" class=\"tooltip IconInner\" align=\"center\ " " +
"src=\"../Lib/images/questionmark.gi f\">" +
"<a href=\"#\" onclick=\"myWin =window.open('' ,'Something','w idth=200');
myWin.document. write('" + helpString +
"')\"></a></span>"
);
}

<!untested!>

Nat wrote:
Help, I have following code:

-----------------------------------------------------

protected override void Render(HtmlText Writer w)
{
if (helpString!=nu ll)
{
w.write("<span class='tooltipi conouter'><img title =
'"+this.helpStr ing+"' class='tooltipI conInner' align='center' src =
'../Lib/images/questionmark.gi f' a href='#' onclick = 'myWin =
window.open(); myWin.document. write(\"" +helpString+
"\")'></a></span>");
}

-----------------------------------------------------

I want to add some parameters in to the window.open() or in the
document.write( ), så I can control the window size, bg. color and name
-
how do I write that into the code above??

(If I fx. write: window.open('', 'Something','wi dth=200 height'),
depending on where I put it in, it either doesn't open a new window,
or it reseizes the image).

Thanks


Nov 15 '05 #2
Hi,

You have to escape the " of the parameters of window.open:

w.Write("..... " + " onClick='
win=window.Open (\"theurl\",\"t hename\",\"widt h=200,height=20 0\");return
false;' ");

Hope this help,

--
Ignacio Machin,
ignacio.machin AT dot.state.fl.us
Florida Department Of Transportation

"Nat" <nm@sondagsavis en.dk> wrote in message
news:da******** *************** **@posting.goog le.com...
Help, I have following code:

-----------------------------------------------------

protected override void Render(HtmlText Writer w)
{
if (helpString!=nu ll)
{
w.write("<span class='tooltipi conouter'><img title =
'"+this.helpStr ing+"' class='tooltipI conInner' align='center' src =
'../Lib/images/questionmark.gi f' a href='#' onclick = 'myWin =
window.open(); myWin.document. write(\"" +helpString+
"\")'></a></span>");
}

-----------------------------------------------------

I want to add some parameters in to the window.open() or in the
document.write( ), så I can control the window size, bg. color and name
-
how do I write that into the code above??

(If I fx. write: window.open('', 'Something','wi dth=200 height'),
depending on where I put it in, it either doesn't open a new window,
or it reseizes the image).

Thanks

Nov 15 '05 #3
Nat


I made some few ajustments to the code Antenna gave me, so it could
build, and it seems to work, but it doesn't open any window..why??

The code looks like this now:

--------------------------------------

protected override void Render(HtmlText Writer w)
{
if (helpString!=nu ll)
{
w.Write("<span class='tooltipi conouter'>" + "<img title=\"" +
this.helpString + "\" class=\"tooltip IconInner\" align=\"center\ " " +
"src=\"../lib/images/questionmark.gi f\">" + "<a href=\"#\"
onclick=\"myWin =window.open('' ,'Something','w idth=200');
myWin.document. write('" + helpString + "')\"></a></span>");
}
}

-----------------------------

If I view the html code that is generated, it looks like this:

<td><span id="_ctl0_EditO rganization1_EX TLABEL1"
class="brod">Ku ndenummer</span><span class='tooltipi conouter'><img
title="bla bla bla bla" class="tooltipI conInner" align="center"
src="../lib/images/questionmark.gi f"><a href=#
onclick="myWin= window.open('', 'Something','wi dth=200');
myWin.document. write('bla bla bla bla')"></a></span></td>

-------------------------------

Am I missing something??

Thanks for the help :o)

*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!
Nov 15 '05 #4
Nat


I've solved the problem. Thanks for all your help.

The code (in onclick) have to look like this:

......
onclick = 'myWin = window.open(\"\ ", \"Tip\", \"width=200 height=300\")
......

Nat

*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!
Nov 15 '05 #5

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

6
12972
by: Mike Daniel | last post by:
I am attempting to use document.write(pageVar) that displays a new html page within a pop-up window and the popup is failing. Also note that pageVar is a complete HTML page containing other java scripts. Being a javascript newbie and after significant testing, I suspect that the document.write fails after finding a </script> within pageVar. Does a trick exist that enables one to slightly alter pageVar whereby enabling...
13
9607
by: Stumped and Confused | last post by:
Hello, I really, really, need some help here - I've spent hours trying to find a solution. In a nutshell, I'm trying to have a user input a value in form's textfield. The value should then be assigned to a variable and output using document.write. (Note, there is no submit button or other form elements. Basically
14
4112
by: Eli | last post by:
I've got a script that I'm trying to debug which uses document.write() to place HTML within a page. In both IE6 and Firefox when I view source, I see only the script itself and not any HTML as it's being written into the page. Is there a way that I can view what is being placed into the page, instead of, or in addition to the javascript code?
4
2944
by: Prowler | last post by:
In the application we are currently building, we need to write positioning code on-the-fly, based upon the screen offset of the element in the AS/400 application which drives the Web app. The 400, like DOS, uses memory-mapped display, two bytes per character (one char byte and one attribute byte). We can get the screen offset allright, and I've written a javascript which does the math to convert the offset into row/col (i.e. left, top)...
2
5760
by: bissatch | last post by:
Hi, I am trying to use JavaScript to write a table column on a web page. The code is as follows: <html> <head> <script> function displaycount() {
8
9411
by: '69 Camaro | last post by:
Perhaps I'm Googling for the wrong terms. Does anyone have links to examples of the syntax necessary to read the HTML on another Web page when that HTML is produced from JavaScript using the document.write( ) method? For a simplified example, I have two Web pages. Page 1 uses JavaScript with the following: htmlData = "<B>This is bold text.</B>"; document.write(htmlData);
17
1656
by: cass27 | last post by:
I am just doing a course on Javascript and have begun to try out different ideas. The effect I wanted was fro the user to click on a graphic. Aprompt box would apprear asking their name and that imfo would be transferred to the top of that page. However the users name will only appear on a seperate page. The code i am using (in brief) is as follows: function getname() {
3
3308
by: =?Utf-8?B?SmFzb24gSGFydHNvZQ==?= | last post by:
I get the error: Sys.WebForms.PageRequestManagerParserErrorException: The message received from the server could not be parsed. Common causes for this error are when the response is modified by calls to Response.Write...when i postback to the page. The problem is, i need to write some dynamic javascript on postback and make sure it's rendered to the page. I'm setting up Omniture analytics for my site, <script language="JavaScript"...
0
8425
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
8326
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
8845
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...
0
8743
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
6177
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
5647
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
4333
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
2745
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
1736
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.