[pmwiki-devel] Select & Option Dropdown-list Markup
Hans
design5 at softflow.co.uk
Wed Dec 13 08:21:06 CST 2006
Wednesday, December 13, 2006, 8:13:27 AM, Dominique wrote:
> As you both:
> * introduced some javascript code,
> * embed the submit button,
> could you also add a dash of javascript to hide this last submit
> button (which is only required for javascript-disabled browser)?
We may run into the problem, that a jumpbox markup inserted into a
SideBar may not be able to load javascript into the page head (this is
a general problem as I remember). So a $HTMLHeaderFmt[] insert can't
be done from within the markup function, which means it must be done
from without. Maybe not a big deal, just a little niggle I get from
time to time.
Using my skins (Gemini, FixFlow, Triad) I can use a conditional to
hide or display buttons etc if browser can use javascript:
(:if enabled javascript:)special bits...
(:if !enabled javascript:)ordinary bits...(:if:)
To check for javascript the skins set a session-long cookie, and a
global javascript variable is set accordingly if php can read the
cookie.
in skin after <body>:
<script type='text/javascript'>
<!-- document.cookie = 'javascript=1; path=/'; -->
</script>
and in skin.php:
global $javascript;
if (isset($_COOKIE['javascript'])) $javascript = $_COOKIE['javascript'];
Maybe not too smart, as it relies on cookies being enabled.
Also on first visit to a site on first page load, the global
$javascript is not set yet, as a new cookie is just been set.
So only with the second page load does php know that javascript is
enabled (and cookies).
If you know of a better way for a general javascript enable-test
please let me know!
Hans
More information about the pmwiki-devel
mailing list