Tycoon Talk
Become a Big fish!
The number 1 forum for online business!
Post topics, ask questions, share your knowledge.
Tycoon Talk is part of Freelancer.com - find skilled workers online at a fraction of the cost.

Coding Forum


You are currently viewing our Coding Forum as a guest. Please register to participate.
Login



Reply
Old 06-14-2002, 09:44 AM cgi/java query
Junior Talker

Posts: 2
Trades: 0
Hi,
I`m trying to pull some java up from a cgi script, and I`m having problems, I`m guessing, so
how would i write -

<!-- if (navigator.appName == "Microsoft Internet Explorer"){ document.write("<a href=\"http://www.any.com/\" onClick=\"parent.Preview(this);return false\" class=\"nlg\"><b>PreviewThis</b></a>");}else{ document.write(" - ");}//-->


it needs to go inbetween -

print "<script language=JavaScript></script>";

and it does not work in it`s present format, what do you think is wrong, anybody?

Thanks

Mel
elmpie is offline
Reply With Quote
View Public Profile
 
 
Register now for full access!
Old 06-14-2002, 05:24 PM Re: cgi/java query
Tiggy's Avatar
Ultra Talker

Posts: 249
Location: Lancashire, UK
Trades: 0
I'm not into JavaScript as a rule, but I can tell you what is wrong with it... first of there might be problems if all of it was just the one line...

<!--
if (navigator.appName == "Microsoft Internet Explorer") {
&nbsp; &nbsp; document.write('<a href="http://www.any.com/" onClick="javascript:parent.Preview(this);return false;" class="nlg"><b>PreviewThis</b></a>');
} else {
&nbsp; &nbsp; document.write(' - ');
}//-->

Try that, I've bolded the changes (note that JavaScript is all one word but the board broke it up). I'm not sure which way around the single or double quotes go (i.e if it's single inside double or double inside single) - but it was the only thing obivious I could see that might cause a problem.
__________________
Web Site Owner's Resource -
Please login or register to view this content. Registration is FREE
Tiggy is offline
Reply With Quote
View Public Profile
 
Old 06-14-2002, 05:30 PM
Junior Talker

Posts: 2
Trades: 0
Thanks Tiggy,
I`ll give this a play with,

Mel, appreciate it.
elmpie is offline
Reply With Quote
View Public Profile
 
Old 06-14-2002, 05:55 PM
Skilled Talker

Posts: 66
Location: British Columbia, Canada
Trades: 0
When using quotes inside of quotes you have to do one the following:

instead of double quotes in javascript, use single quotes
or,
use the markup code for it likes this \"

Note: I do not use perl so I am assuming that the
PRINT statement also ends with a ; like javascript does.

In this example I have converted all quotes to \"

print "<script language=JavaScript>";
print "<!--";
print "if (navigator.appName == \"Microsoft Internet Explorer\") {";
print " document.write('<a href=\"http://www.any.com/\" ";
print "onClick=\"javascript:parent.Preview(this);ret urn false;\" ";
print "class=\"nlg\"><b>PreviewThis</b></a>');";
print "} else { ";
print " document.write(' - '); ";
print "}//--> ";
print "</script>";
wynpublishing is offline
Reply With Quote
View Public Profile
 
Reply     « Reply to cgi/java query
 

Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are Off
Pingbacks are Off
Refbacks are Off





   
RSS Feed  Feeds: RSS   JS   XML
RSS Feed  Feeds for this forum: RSS   JS   XML



Page generated in 0.13342 seconds with 12 queries