CGI/Perl Guide | Learning Center | Forums | Advertise | Login
Site Search: in

  Main Index MAIN
Search Posts SEARCH
Who's Online WHO'S
Log in LOG

Home: Perl Programming Help: Beginner:
Inserting JavaScript into perl source



Feb 5, 2000, 12:42 PM

Post #1 of 6 (2042 views)
Inserting JavaScript into perl source Can't Post


I have some problem. How to insert java scripts into perl source ?
I need to insert Flycast code into source with the document.write command
Where is the problem?
It looks like this:

<BLOCKQUOTE><font size="1" face="Arial,Helvetica,sans serif">code:</font><HR>

document.write('<tr><td><!--Begin Flycast Ad Copyright 1999 Flycast Communications.');
document.write(' All rights reserved. Patent Pending -->');
document.write(' <SCRIPT LANGUAGE="JAVASCRIPT">');
document.write(' <!--');
document.write(' FlycastSite = "UnRealNetwork";');
document.write(' FlycastPage = "Remote";');
document.write(' FlycastWidth = 234;');
document.write(' FlycastHeight = 60;');
document.write(' FlycastPrintTag = true;');
document.write(' FlycastNewAd = true;');
document.write(' FlycastLoaded = false;');
document.write(' FlycastVersion = 3.5;');
document.write(' //-->');
document.write(' </SCRIPT>');
document.write(' <SCRIPT SRC="" LANGUAGE="JAVASCRIPT"></SCRIPT>');
document.write(' <SCRIPT LANGUAGE="JAVASCRIPT">');
document.write(' <!--');
document.write(' if (FlycastLoaded) FlycastDeliverAd();');
document.write(' //-->\\n');
document.write(' </SCRIPT>');
document.write(' <NOSCRIPT>');
document.write(' <IFRAME WIDTH=234 HEIGHT=60 SRC="" scrolling="no" marginwidth=0 marginheight=0 frameborder=0 vspace=0 hspace=0>');
document.write(' <A target="_top" HREF=""><IMG BORDER=0 WIDTH=234 HEIGHT=60 SRC=""></A>');
document.write(' </IFRAME>');
document.write(' </NOSCRIPT>');
document.write('<!--End Flycast Ad Copyright 1999 Flycast Communications. All rights reserved. Patent Pending -->');


Feb 5, 2000, 6:38 PM

Post #2 of 6 (2042 views)
Re: Inserting JavaScript into perl source [In reply to] Can't Post

Can you post the exact code unchange that you have.


Brian Hayes


Feb 6, 2000, 4:48 AM

Post #3 of 6 (2042 views)
Re: Inserting JavaScript into perl source [In reply to] Can't Post


The problem is, that I work on some perl script for offering free poll service.
The people who wants to have poll on there site will have to put something like this on their html page:
<BLOCKQUOTE><font size="1" face="Arial,Helvetica,sans serif">code:</font><HR>

document.write('<script src="><\/script>');

This is the perl script in what I wish to put Flycast code (which is exactly as I posted) and I have to use document.write in it.

Does this have some sense?

Thank you.


Feb 6, 2000, 10:58 AM

Post #4 of 6 (2042 views)
Re: Inserting JavaScript into perl source [In reply to] Can't Post

Hi deadroot:

The reason why isnt not working is because you have javascript problems.
Some of your javascript code works on html but in Perl the entire code must work right to function.

Fix your javascript then it will work in perl.

Heres a example using javscript, in your case document.write in Perl.

print "Content-type: text/html\n\n";
print qq~
<SCRIPT language="javascript">
document.write(' world = 200;');

Note: that it will print world = 200 to the browser if you want to use the world =200 in certain cases then you need to make it a function in javascript.


Feb 6, 2000, 10:03 PM

Post #5 of 6 (2042 views)
Re: Inserting JavaScript into perl source [In reply to] Can't Post

Javascript is processed when the page is loading (or thereabouts) and
your perl program doesn't do much with it. When I use it and Perl
together it looks like:
--- cut here ---
print <<EOF;
--- cut here ---

Perl doesn't do anything with Javascript itself.



Feb 16, 2000, 3:54 PM

Post #6 of 6 (2042 views)
Re: Inserting JavaScript into perl source [In reply to] Can't Post

It's too bad more people don't have PERL installed, then you could just write:

<script language="perlscript">...

Deciding the balance between running on the server (eg Perl, Python...) or the client (Javascript, CSS, DHTML...) can be a bit tricky. My rule of thumb is that if the client's environment has enough info to get the job done, that's where I do it.

Cure's solution looks perfect in this case.


Search for (options) Powered by Gossamer Forum v.1.2.0

Web Applications & Managed Hosting Powered by Gossamer Threads
Visit our Mailing List Archives