Forum Moderators: open

Message Too Old, No Replies

open new window

help w/ script

         

electricocean

6:42 am on Jan 3, 2005 (gmt 0)

10+ Year Member



I have this script that will open up a new window that dos not exist in the filmanager but the javascript calls it up. It's inside a functionand in a link you type in what the body is going to be but it only takes a small amount of html... why?

here's my code:

<script language="javascript">

function popupJoke(title, joke) {
var w = window.open('',title,'width=500,height=500,scrollbars=yes,resizable=yes');
var d = w.document;
d.write('<html><head><title>Dkicks Jokes</title></head><body bgcolor=#FFFFFF>Dkicks / Jokes / ' + title + '<p align="center"><font face="Courier" size="50">' + title + '</font><br><br>' + joke + '<br><FONT SIZE="2" FACE="Verdana,Arial,Helvetica,sans-serif"><a HREF="javascript: self.close()">Close Window</a></font></p></body></html>');
d.close();
w.focus();
}
</script>

Body:

<a href="javascript: popupJoke('Little Johnny&#39;s Wish', 'Little Johnny came home from school one day and went<br>
by his mom's room&#46; The door was open...')">Little Johnny's Wish</a>

[edited by: DrDoc at 2:55 am (utc) on Jan. 4, 2005]

electricocean

6:43 am on Jan 3, 2005 (gmt 0)

10+ Year Member



I put all of those special carachter in to see if that was the problem... qoutation marks, commas, periods, exclamation points, etc.

adni18

3:35 pm on Jan 3, 2005 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



mom's should be mom\'s. Also, you should eliminate the returns. This is the code:

<script language="javascript">
function popupJoke(titl, titl2, joke) {
var w = window.open('about:blank',titl2,'width=500,height=500,scrollbars=yes,resizable=yes');
var d = w.document;
d.write('<html><head><title>Dkicks Jokes</title></head><body bgcolor=#FFFFFF>Dkicks / Jokes / ' + titl + '<p align="center"><font face="Courier" size="50">' + titl + '</font><br><br>' + joke + '<br><FONT SIZE="2" FACE="Verdana,Arial,Helvetica,sans-serif"><a HREF="javascript: self.close()">Close Window</a></font></p></body></html>');
w.focus();
}
</script>

<BODY>
<a href="javascript:void(0)" onClick="popupJoke('Little Johnny\&#39;s Wish', 'LitJohn', 'Little Johnny came home from school one day and went<br> by his mom\'s room...')">Launch Joke</a>

All your numbered HTML entities should be like \&#124;

electricocean

4:34 am on Jan 4, 2005 (gmt 0)

10+ Year Member



That still doen't work...

check the coding on my site:

[dkicks.dk.funpic.org ]

adni18

12:34 pm on Jan 4, 2005 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



First off,

by his mom's room\&#46; The

you still haven't escaped the apostrophe in mom's (mom\'s)

-----------

Secondly, you still haven't removed the return lines.

If you are unsure of the terminology, it's what happens when you hit return, or enter

adni18

12:36 pm on Jan 4, 2005 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



JOUC, do you have access to a server-side language?

electricocean

6:28 pm on Jan 22, 2005 (gmt 0)

10+ Year Member



yes... i think so

electricocean

6:35 pm on Jan 22, 2005 (gmt 0)

10+ Year Member



I am still confused about the return lines