By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
455,667 Members | 1,916 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 455,667 IT Pros & Developers. It's quick & easy.

Write javascript 'into' a c# .NET webapplikation

P: n/a
Nat
Help, I have following code:

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

protected override void Render(HtmlTextWriter w)
{
if (helpString!=null)
{
w.write("<span class='tooltipiconouter'><img title =
'"+this.helpString+"' class='tooltipIconInner' align='center' src =
'../Lib/images/questionmark.gif' 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','width=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
Share this Question
Share on Google+
4 Replies


P: n/a
I suggest you rewrite it a bit, like so:

protected override void Render(HtmlTextWriter w)
{
if (helpString!=null)
{
w.write(
"<span class='tooltipiconouter'>" +
"<img title=\"" + this.helpString +
"\" class=\"tooltipIconInner\" align=\"center\" " +
"src=\"../Lib/images/questionmark.gif\">" +
"<a href=\"#\" onclick=\"myWin=window.open('','Something','width= 200');
myWin.document.write('" + helpString +
"')\"></a></span>"
);
}

<!untested!>

Nat wrote:
Help, I have following code:

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

protected override void Render(HtmlTextWriter w)
{
if (helpString!=null)
{
w.write("<span class='tooltipiconouter'><img title =
'"+this.helpString+"' class='tooltipIconInner' align='center' src =
'../Lib/images/questionmark.gif' 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','width=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

P: n/a
Hi,

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

w.Write("..... " + " onClick='
win=window.Open(\"theurl\",\"thename\",\"width=200 ,height=200\");return
false;' ");

Hope this help,

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

"Nat" <nm@sondagsavisen.dk> wrote in message
news:da*************************@posting.google.co m...
Help, I have following code:

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

protected override void Render(HtmlTextWriter w)
{
if (helpString!=null)
{
w.write("<span class='tooltipiconouter'><img title =
'"+this.helpString+"' class='tooltipIconInner' align='center' src =
'../Lib/images/questionmark.gif' 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','width=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

P: n/a
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(HtmlTextWriter w)
{
if (helpString!=null)
{
w.Write("<span class='tooltipiconouter'>" + "<img title=\"" +
this.helpString + "\" class=\"tooltipIconInner\" align=\"center\" " +
"src=\"../lib/images/questionmark.gif\">" + "<a href=\"#\"
onclick=\"myWin=window.open('','Something','width= 200');
myWin.document.write('" + helpString + "')\"></a></span>");
}
}

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

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

<td><span id="_ctl0_EditOrganization1_EXTLABEL1"
class="brod">Kundenummer</span><span class='tooltipiconouter'><img
title="bla bla bla bla" class="tooltipIconInner" align="center"
src="../lib/images/questionmark.gif"><a href=#
onclick="myWin=window.open('','Something','width=2 00');
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

P: n/a
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 discussion thread is closed

Replies have been disabled for this discussion.