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.

PHP Forum


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



Freelance Jobs

Reply
Old 07-06-2006, 07:43 PM javascript in link
Skilled Talker

Posts: 97
Trades: 0
PHP Code:
if ($feed->get_feed_link()) echo "<a href=\"javascript:hideshow(document.getElementById('adiv'))\">" echo $feed->get_feed_title(); if ($feed->get_feed_link()) echo '</a>'?> 
can someone correct the link for me
i cant figure out how to get it to work


heres the javascript
PHP Code:
<script type="text/javascript">
function 
hideshow(which){
if (!
document.getElementById)
return
if (
which.style.display=="block")
which.style.display="none"
else
which.style.display="block"
}
</script> 
when you click the link, it shows the div id with the css code: display: block

i get this error
Parse error: parse error, unexpected T_ECHO, expecting ',' or ';' in C:\xampplite\htdocs\rss\test\test.php on line 25
__________________

Please login or register to view this content. Registration is FREE


Please login or register to view this content. Registration is FREE
raptrex is offline
Reply With Quote
View Public Profile Visit raptrex's homepage!
 
 
Register now for full access!
Old 07-06-2006, 10:38 PM Re: javascript in link
Webmaster Talker

Posts: 626
Trades: 0
Quote:
Originally Posted by raptrex
PHP Code:
if ($feed->get_feed_link()) echo "<a href=\"javascript:hideshow(document.getElementById('adiv'))\">" echo $feed->get_feed_title(); if ($feed->get_feed_link()) echo '</a>'?> 
You can only have one echo per statement:

PHP Code:
$feed_title $feed->get_feed_title();

if(
$feed->get_feed_link()) {
  echo 
"<a href=\"javascript:hideshow(document.getElementById('adiv'))\">$feed_title</a>"
I'm not sure what you are trying to do there... Why do you have an if statement to echo "</a>"??

Anyways, you can see what I did there... You were using echo twice, but you can only use it once per line.

Last edited by jim.thornton; 07-06-2006 at 10:39 PM..
jim.thornton is offline
Reply With Quote
View Public Profile
 
Reply     « Reply to javascript in link
 

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.19509 seconds with 12 queries