For the moment I am using a JS function to show or hide a division.
It works fine in IE7, but not in firefox 2 or opera 9.
Yes I have JS enabled on both.
Is there a better way using PHP?
Which I would prefer using.
Forget the content, just concentrate on the problem thank you.
Two questions:
1) why are you developing for IE, instead of for standards-compliant browsers?
2) why do you care about Firefox 2? Hardly anyone is using it any more...
>
>Yes I have JS enabled on both.
>
>Is there a better way using PHP?
PHP is a server-side scripting tool. How do you propose to use it to change
whether the division is displayed or hidden on the _client_?
> In article <1rkl0vr49cdjm$.12ip02ikgb5td$.d...@40tude.net>, richard <mem...@newsguy.com> wrote:
>>http://blog.1littleworld.net/
>>
>>For the moment I am using a JS function to show or hide a division.
>>It works fine in IE7, but not in firefox 2 or opera 9.
>
> Two questions:
> 1) why are you developing for IE, instead of for standards-compliant browsers?
> 2) why do you care about Firefox 2? Hardly anyone is using it any more...
I was under the impression that this script worked on numerous browswers.
Obviously not.
As to why I use FF2, when 3 came out, it had bugs in it I didn't like and
reverted.
>>
>>Yes I have JS enabled on both.
>>
>>Is there a better way using PHP?
>
> PHP is a server-side scripting tool. How do you propose to use it to change
> whether the division is displayed or hidden on the _client_?
Can you provide a viable solution or not?
Solved.
Found a script that works in all 3 browsers.
All three? What about the other twenty seven?
And it had absolutely nothing to do with PHP, did it?
First of all - clean up your code:
Result: 0 errors / 11 warnings
line 1 column 1 - Warning: missing <!DOCTYPE> declaration
line 41 column 8 - Warning: adjacent hyphens within comment
line 251 column 1 - Warning: missing </div>
line 27 column 1 - Warning: missing </div>
line 3 column 1 - Warning: inserting missing 'title' element
line 16 column 1 - Warning: <div> proprietary attribute "name"
line 18 column 2 - Warning: <div> proprietary attribute "name"
line 22 column 2 - Warning: <div> proprietary attribute "name"
line 27 column 1 - Warning: <div> proprietary attribute "name"
line 252 column 1 - Warning: <div> proprietary attribute "name"
line 241 column 1 - Warning: trimming empty <p>
Info: Document content looks like HTML Proprietary
Info: No system identifier in emitted doctype
Also, at about line 244 you have </div (no closing bracket)
You can also optimise your code:
function showHide(elementid){
var id = document.getElementById(elementid);
var dsp = (id.style.display == 'none') ? "" : "none";
id.style.display = dsp;
}
HTH
Also you can't really "compare" JS and PHP.
PHP is executed at the server and JS is run by the browser, so the questions is
kinda wrong.
regards,
johannes keßler
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v2.0.13 (GNU/Linux)
iEYEARECAAYFAkrxQHMACgkQE++2Zdc7EtdzJQCgorDVh5gqBUtZ2DuefXTMru5I
iCEAn0C1cMxhbOHBO56r5yql5+12qYQf
=rvMX
-----END PGP SIGNATURE-----
Twenty of which 10 in 10,000 might use.
>
> And it had absolutely nothing to do with PHP, did it?
No. But there is no reason why it could not be done in php.
The only reason, for now, that I am using php is to get the "Today's date"
stamp as I want. Since that is coming from the server.
In the future I may be implementing other server side items.
>> And it had absolutely nothing to do with PHP, did it?
>
> No. But there is no reason why it could not be done in php.
There are quite valid and domonstrable reasons why this simply can not be
done using PHP but I am sure that the sheer number of them (one) is totally
beyond you RtS.
> The only reason, for now, that I am using php is to get the "Today's
> date" stamp as I want. Since that is coming from the server.
And what does that date stamp mean to me? I am on the other side of the
planet from you, thankfullyl. In less than two hours it will be Thursday
Novermber 05, 2009 over here. What will your stupid little site say the date
is then? You won't catch up to *my* time for at least fourteen hours plus or
minus, taking daylight saving time into account.
A perfect example of your misunderstanding of the difference between server
side and client side, and to extrapolate, your understanding of the
difference between server side programming and client side programming.
> In the future I may be implementing other server side items.
&deity forbid. A datestamp, now. What next? A hit counter? Where you gonna
save the count? On the back of your federal truck drivers licence?
Are you sure about that? I wouldn't be, if I were you.
>> And it had absolutely nothing to do with PHP, did it?
>
> No. But there is no reason why it could not be done in php.
> The only reason, for now, that I am using php is to get the "Today's date"
> stamp as I want. Since that is coming from the server.
>
Yes, there is. As you have been told before - PHP is server-side. You
are looking for a change in client-side functionality. But you still
don't understand the difference, do you?
> In the future I may be implementing other server side items.
You mean in the future you may be implementing server-side items. No
"other".
--
==================
Remove the "x" from my email address
Jerry Stuckle
JDS Computer Training Corp.
jstu...@attglobal.net
==================
Not to mention the fact javascript is off topic in a PHP newsgroup.
Of course: use a client-side scripting tool to change the client behavior.
<?php
//server side
$shouldhide=TRUE;
if($shouldhide){
echo '<div id="thediv">you are clueless on how html and php work
together. Do search for "AJAX"</div>';
}
?>