Main
Index
Search
Posts
Who's
Online
Log
In

Home: Discontinued/Classic Products: Listings Manager (Realty Manager & Auto Manager):
Javascript test not working

 

 


webpilgrim
User

Sep 3, 2008, 3:15 PM

Post #1 of 7 (3353 views)
Shortcut
Javascript test not working Can't Post

I have a field 'lfield33' that either contains a URL or is empty.
I want the URL to appear if the field contains one and a 'Sorry' message if it does not. Here is my code:
(It includes a few lines above it in _publish_listings.html so you can find the place in the file:)

<table border=0 cellspacing=2 cellpadding=0>
<tr>
<td><font face="ms sans serif" size=2>Listed by:&nbsp;</font></td>
<td><font face="ms sans serif" size=2><a href="$homepage_url$/$user_file$">$user_name$</font></a> <span style="background-color: #000080"><font face="arial" size="2" color="#FFFFFF"> &nbsp;(<a href="$search_url$?user_num=$user_num$&search=1">View my listings</a>)</font></span></td>
</tr>
<tr><td></td></tr>
<tr>
<td><font face="ms sans serif" size=2>View Map:&nbsp;</font></td>
<td><font face="ms sans serif" size=2><a href="http://maps.yahoo.com/py/maps.py?Pyt=Tmap&addr=$lfield1_ue$&csz=$lfield3_ue$%2C%20$lfield4_ue$&Get+Map=Get+Map" target="_blank">Click Here to view map of area</a></font></td>
</tr>

<!-- Check for listingdomain existence and show url or show sorry -->
<TR>
<TD><font face="arial" size="1">Online Tour:</font></TD>
<TD>
<script type="text/javascript" language="javascript">
<!--
if ('$field33$') {
document.write('<font face="arial" size="2"> <a href="http://www.$lfield33$" target="new">Click here</a></font>');
} else {
document.write('<font face="arial" size="2">Sorry, currently no online tour</font>');
}
// -->
</script>
</TD>
</TR>
<!-- End listingdomain check -->

</table>

It looks just like an example I found in the forum, but mine doesn't work. Any ideas ?


Donna
Staff / Moderator


Sep 3, 2008, 3:22 PM

Post #2 of 7 (3351 views)
Shortcut
Re: [webpilgrim] Javascript test not working [In reply to] Can't Post

Hi there,

What happens when you put that code in? Is there any error message? Does anything display?

If possible, could you give me a link to where this is on your site?

Donna

--
support@interactivetools.com


webpilgrim
User

Sep 3, 2008, 3:25 PM

Post #3 of 7 (3350 views)
Shortcut
Re: [Donna] Javascript test not working [In reply to] Can't Post

with the above code, it always says 'Sorry, no tour available'
So, I simplified it:

<!-- Check for listingdomain existence and show url or show sorry -->
<script type="text/javascript">
if ('$field33$')
{
document.write('<font face="arial" size="2"> <a href="http://www.$lfield33$" target="new">Click here to tour $lfield2$</a></font>');
}
</script>
<!-- End listingdomain check

Shows nothing.

Here is a link:
http://www.ronbordersrealestate.com/cgi-bin/listman/listings/l0041.html

This listing has a URL in field 33

Thanks,

Randy


Donna
Staff / Moderator


Sep 3, 2008, 3:27 PM

Post #4 of 7 (3348 views)
Shortcut
Re: [webpilgrim] Javascript test not working [In reply to] Can't Post

Hi there!

Ah-hah! I see the problem: You've got a teeny typo in your "if" statement.

if ('$field33$')

should be:

if ('$lfield33$')

Switch that, and it should start working. :)

Donna

--
support@interactivetools.com


webpilgrim
User

Sep 3, 2008, 3:29 PM

Post #5 of 7 (3347 views)
Shortcut
Re: [Donna] Javascript test not working [In reply to] Can't Post

As many times as I've looked at that code . . ..

[chagrined embarrassment]

Thanks

Randy


Donna
Staff / Moderator


Sep 3, 2008, 3:30 PM

Post #6 of 7 (3346 views)
Shortcut
Re: [webpilgrim] Javascript test not working [In reply to] Can't Post

No worries -- I didn't see it either, til I viewed your source and realized it was displaying the placeholder output in one spot, but not the other. :)

Donna

--
support@interactivetools.com


webpilgrim
User

Sep 3, 2008, 3:32 PM

Post #7 of 7 (3345 views)
Shortcut
Re: [Donna] Javascript test not working [In reply to] Can't Post

that worked, I'll get about cleaning up the look now.

Randy