|
| Index | Recent Threads | Unanswered Threads | Who's Online | User List | Help |
|
|
| No member browsing this thread |
|
Thread Status: Active Total posts in this thread: 13
|
|
| Author |
|
|
Member Joined: Aug 25, 2006 Post Count: 50 Status: Offline |
I've found plenty of solutions for passing variables etc. from JS to PHP and vice versa, but none of them seem to solve my problem. I want to know if Javascript is enabled in the client's browser. If it isn't then I want to do something different. Obviously, if it isn't, then Javascript won't run. How can I capture this with PHP? BTW, get_browser isn't updated on my server and I don't have access to change it. TC ---------------------------------------- http://tcallaway.com |
||
|
|
Advanced Member Joined: Jun 14, 2003 Post Count: 2940 Status: Offline |
Interesting question. My first inclination would be to attempt an AJAX call - if it works then you know the client supports Javascript. ---------------------------------------- Stefan Mischook Video Tutorial Store | Web Templates |
||
|
|
Advanced Member USA Joined: Nov 27, 2003 Post Count: 6285 Status: Offline |
New site or revamp? Just wondering why even use JS then, PHP can do anythig JS can do without being turned off... |
||
|
|
Member Joined: Sep 20, 2005 Post Count: 62 Status: Offline |
Can you parse PHP on mouse events? I've never seen it done, not saying it's impossible! How bout PHP alert windows (also mostly used with mouse state)? Those can be handy for form-filing. I'm not saying it cannot be done, I'm guessing there is some method for doing so. Just curious as to if it can. |
||
|
|
Advanced Member Joined: Jun 14, 2003 Post Count: 2940 Status: Offline |
Hi, You cannot (directly) do any client-side parsing with PHP - PHP is a server-side language. That is to say that PHP does it's thing on the server, before the browser gets the page. The process:
That means you cannot trap for mouse events, spawn alert boxes or anything else that is browser specific with PHP. This has to be controlled via Javascript. ---------------------------------------- Stefan Mischook Video Tutorial Store | Web Templates |
||
|
|
Member Joined: Aug 25, 2006 Post Count: 50 Status: Offline |
New site or revamp? Just a new project that might become a new site. I'm using JS to show/hide contents of a block element (div, span, p, etc.). Very simple JS that changes the style of the block element from display:none to display:block or inline. Obviously this won't work with JS turned off in the browser. Is there a way to do this in PHP? I haven't been able to find it if there is. @admin, it looks to me that if JS is off, AJAX won't work either. Although I haven't studied AJAX at all and only given it an hour or two of research, all the AJAX calls I've seen use JS to begin with. Maybe I'm missing something? TC ---------------------------------------- http://tcallaway.com |
||
|
|
Advanced Member USA Joined: Nov 27, 2003 Post Count: 6285 Status: Offline |
Ok, odd case where JS is needed... just not sure that it is really a good idea to do what you want to do. What would be the default? If the text is available and the JS hides it that is OK. But if the text is hidden with display:none ... when JS is not supported, the text is gone and falls away, the CSS command has removed it from the page and it is lost to anyone unless they turn of CSS too. If you use JS in such a manner the default must make the text available for those who do not support JS. |
||
|
|
Advanced Member Joined: Jun 14, 2003 Post Count: 2940 Status: Offline |
Hi, That is what I am saying - if the ajax doesn't work, you know js is off. It is hard to come up with a design without knowing some details about what you are trying to do. BTW: JS is usually off only about 10% or less .. depending on the site. ---------------------------------------- Stefan Mischook Video Tutorial Store | Web Templates |
||
|
|
Advanced Member Joined: Sep 3, 2005 Post Count: 2206 Status: Offline |
Here's a bit of php code that may do what you want. If so, I don't see a need for javascript. <?phpThen write the links to show the contents of each file, replace mypage with the file name of your webpage : <ul id="menu">---------------------------------------- Quiquid latine dictum sit altum viditur ---------------------------------------- [Edit 1 times, last edit by billyboy at Sep 22, 2006 6:28:06 PM] |
||
|
|
Member Joined: Aug 25, 2006 Post Count: 50 Status: Offline |
LSW: Ok, odd case where JS is needed... just not sure that it is really a good idea to do what you want to do. Agreed, but we're in testing mode here and it might turn out to work. LSW: What would be the default? If the text is available and the JS hides it that is OK. The default would show all the text. Which is actually an RSS feed that is loaded in another place on the page. The page would be messy, but it will all be there. Ergo, if JS is off, PHP will change the style to show all the text. I'm also thinking of using this same concept to load pictures in a separate element (probably a table cell) from thumbnails along side the element. I've seen this done with JS, but if it's off if won't work then I can get PHP to link to a page with all the pictures. admin: That is what I am saying - if the ajax doesn't work, you know js is off. And that is what I'm saying. With my limited knowledge of AJAX I can't see how to make PHP get the null return. admin: It is hard to come up with a design without knowing some details about what you are trying to do. The file is on my web site (see my signature) re_rss.php. If you need the code I can upload it as a text file. I can do it with PHP by reloading the page each time but I don't think you can show but one feed at a time with this method. With the JS you can see all the feeds you turn on and you can turn them off individually too. As for the thumbnail exchange I mentioned, if JS is off then each TN will link to the separate page. admin: BTW: JS is usually off only about 10% or less .. depending on the site. I'm aware of that too, but in the real estate business, every 10% counts. I'm not an agent, just a computer jockey, but RE is my bread and butter and I try to be as innovative as possible because it is so competitive. TC ---------------------------------------- http://tcallaway.com |
||
|
|
|
|
|
Current timezone is GMT May 25, 2013 5:04:48 PM |