Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

problem with script

3 views
Skip to first unread message

richard

unread,
Nov 3, 2009, 10:54:58 PM11/3/09
to
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.

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.

Doug Miller

unread,
Nov 3, 2009, 11:45:35 PM11/3/09
to
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...


>
>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_?

richard

unread,
Nov 3, 2009, 11:57:04 PM11/3/09
to
On Wed, 04 Nov 2009 04:45:35 GMT, Doug Miller wrote:

> 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?

richard

unread,
Nov 4, 2009, 2:24:46 AM11/4/09
to

Solved.
Found a script that works in all 3 browsers.

rf

unread,
Nov 4, 2009, 2:36:01 AM11/4/09
to

All three? What about the other twenty seven?

And it had absolutely nothing to do with PHP, did it?


Jeff North

unread,
Nov 4, 2009, 2:50:56 AM11/4/09
to
On Tue, 3 Nov 2009 20:54:58 -0700, in comp.lang.php richard
<mem...@newsguy.com>
<1rkl0vr49cdjm$.12ip02ikgb5td$.d...@40tude.net> wrote:

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

johannes keßler

unread,
Nov 4, 2009, 3:50:59 AM11/4/09
to
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

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-----

richard

unread,
Nov 4, 2009, 5:05:11 AM11/4/09
to

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.

Message has been deleted

rf

unread,
Nov 4, 2009, 6:15:24 AM11/4/09
to
richard wrote:
> On Wed, 04 Nov 2009 07:36:01 GMT, rf wrote:
>
>> richard wrote:
>>> On Tue, 3 Nov 2009 20:54:58 -0700, richard 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.
>>>>
>>>> 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.
>>>
>>> Solved.
>>> Found a script that works in all 3 browsers.
>>

>> 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?


Jerry Stuckle

unread,
Nov 4, 2009, 6:16:39 AM11/4/09
to
richard wrote:
> On Wed, 04 Nov 2009 07:36:01 GMT, rf wrote:
>
>> richard wrote:
>>> On Tue, 3 Nov 2009 20:54:58 -0700, richard 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.
>>>>
>>>> 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.
>>> Solved.
>>> Found a script that works in all 3 browsers.
>> All three? What about the other twenty seven?
>
> Twenty of which 10 in 10,000 might use.
>

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
==================

Jerry Stuckle

unread,
Nov 4, 2009, 6:17:13 AM11/4/09
to
houghi wrote:

> richard wrote:
>> Solved.
>> Found a script that works in all 3 browsers.
>
> Please don't tell anybody what the solution was. It is much more fun
> looking for it ourselves.
>
> houghi

Not to mention the fact javascript is off topic in a PHP newsgroup.

Doug Miller

unread,
Nov 4, 2009, 7:45:05 PM11/4/09
to
In article <rmrb9dy4x085$.17k618ze2vfz8$.d...@40tude.net>, richard <mem...@newsguy.com> wrote:
>On Wed, 04 Nov 2009 04:45:35 GMT, Doug Miller wrote:
[...]

>> 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?

Of course: use a client-side scripting tool to change the client behavior.

Danny Wilkerson

unread,
Nov 6, 2009, 7:01:36 AM11/6/09
to
<!-- client side -->
<div id="thediv">client side here unless to know how to compile php
and register it as a scripting host on windows producing massive
security hole.</div>
<script type="text/javascript">
var shouldhide=true;
var obj = document.getElementById('thediv');
if(obj && shouldhide){
obj.style.display='none';
}else{
obj.style.display='block';
}
</script>

<?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>';
}

?>

0 new messages