473,796 Members | 2,708 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Javascript to OPTIONALLY hide HTML/JS

Hi all:

Please excuse a newbie question but I could use some assistance.

I have a large number of "help pages" for an application which we provide.
Within those pages are sections of code that I want to conditionally comment
out. These sections include HTML and Javascript elements. A sample:

<p>For more information <script language="javas cript">advanced Help("
<strong>Click Here</strong>","13.ht m");</scriptto launch the help page.

I've tried to define functions optionalHelpSta rt and optionalHelpEnd which
would either be defined as empty (if we want the code above to be executed)
or as follows if we wanted to hide it:

function optionalHelpSta rt()
{
document.write ("<!--");
}

function optionalHelpEnd ()
{
document.write< "-->");
}

and then recoding as follows:

<script language="javas cript">optional HelpStart();</script>
<p>For more information <script language="javas cript">advanced Help("
<strong>Click Here</strong>","13.ht m");</scriptto launch the help page.
<script language="javas cript">optional HelpEnd();</script>

but this doesn't work (even if I put it all on a single line).

Is there a simple way that I can get this to work? The major problem is that
we've got two products, one which supports the "advancedHe lp" files and one
that does not and we don't want to maintain two sets of files (there are
something like 20 of them in each of 9 languages so far).

Thanks in advance.

- Dave
Jun 27 '08 #1
7 1112
"David In NH" <dg****@gmail.c om>
<snip>
<p>For more information <script language="javas cript">advanced Help("
<strong>Click Here</strong>","13.ht m");</scriptto launch the help page.
Can't you give <pa class and hide the lot via CSS in the product where you
do not want to show this advanced help? It would remove all occurrences via
one simple parameter.
Tom
Jun 27 '08 #2

"Tom de Neef" <td*****@qolor. nlwrote in message
news:48******** *************** @news.xs4all.nl ...
"David In NH" <dg****@gmail.c om>
<snip>
><p>For more information <script language="javas cript">advanced Help("
<strong>Clic k Here</strong>","13.ht m");</scriptto launch the help page.

Can't you give <pa class and hide the lot via CSS in the product where
you do not want to show this advanced help? It would remove all
occurrences via one simple parameter.
Tom

Sorry Tom but I really am a newbie to this. I've inherited this work from
the original programmer and am not familiar with CSS. I'll look into it
though. Thanks for your suggestion.

- David
Jun 27 '08 #3
pr
David In NH wrote:
I have a large number of "help pages" for an application which we provide.
Within those pages are sections of code that I want to conditionally comment
out.
[...]

Sounds like you're trying to use JavaScript to counteract an authoring
problem. You might get something to work - at least on users' PCs that
have JavaScript available and enabled - but ISTM that you should be
looking instead at:

a. some kind of authoring system: content management software or a
custom solution (eg XHTML + XSLT).

b. server code (eg PHP, ASP) to disable the unwanted bits of web pages,
probably triggered by the query string (eg
'myhelp.html?pr oduct=standard| deluxe') and/or a cookie.

(b) is the quicker. (a) is the more sensible. JavaScript doesn't have a
lot going for it in this case.
Jun 27 '08 #4

"David In NH" <dg****@gmail.c omschreef in bericht
news:8s******** *************** *******@comcast .com...
>
"Tom de Neef" <td*****@qolor. nlwrote in message
news:48******** *************** @news.xs4all.nl ...
>"David In NH" <dg****@gmail.c om>
<snip>
>><p>For more information <script language="javas cript">advanced Help("
<strong>Cli ck Here</strong>","13.ht m");</scriptto launch the help
page.

Can't you give <pa class and hide the lot via CSS in the product where
you do not want to show this advanced help? It would remove all
occurrences via one simple parameter.
Tom


Sorry Tom but I really am a newbie to this. I've inherited this work from
the original programmer and am not familiar with CSS. I'll look into it
though. Thanks for your suggestion.

- David
<style>
p.advanced {visible=no} // or {visible=yes} I am guessing here; check the
styles applicable to <p>
</style>

<p class=advanceda ll text here will not show unless you change the
stylesheet</p>

Tom
Jun 27 '08 #5

"Tom de Neef" <td*****@qolor. nlwrote in message
news:48******** *************** @news.xs4all.nl ...
>
"David In NH" <dg****@gmail.c omschreef in bericht
news:8s******** *************** *******@comcast .com...
>>
"Tom de Neef" <td*****@qolor. nlwrote in message
news:48******* *************** *@news.xs4all.n l...
>>"David In NH" <dg****@gmail.c om>
<snip>

<p>For more information <script language="javas cript">advanced Help("
<strong>Clic k Here</strong>","13.ht m");</scriptto launch the help
page.
Can't you give <pa class and hide the lot via CSS in the product where
you do not want to show this advanced help? It would remove all
occurrences via one simple parameter.
Tom


Sorry Tom but I really am a newbie to this. I've inherited this work from
the original programmer and am not familiar with CSS. I'll look into it
though. Thanks for your suggestion.

- David

<style>
p.advanced {visible=no} // or {visible=yes} I am guessing here; check the
styles applicable to <p>
</style>

<p class=advanceda ll text here will not show unless you change the
stylesheet</p>

Tom
Tom! You be da man! This is close to what I eventually winded up using (a
little bit of Javascript that expands to code similar to what you
suggested).

My work just got a lot easier!
Jun 27 '08 #6
Tom de Neef meinte:
<style>
p.advanced {visible=no} // or {visible=yes} I am guessing here; check the
styles applicable to <p>
</style>
Rather set element.style.d isplay to either "block" or "none".

You don't need to switch css classes.

Gregor

--
http://photo.gregorkofler.at ::: Landschafts- und Reisefotografie
http://web.gregorkofler.com ::: meine JS-Spielwiese
http://www.image2d.com ::: Bildagentur für den alpinen Raum
Jun 27 '08 #7
Tom de Neef wrote:
"David In NH" <dg****@gmail.c omschreef in bericht
>"Tom de Neef" <td*****@qolor. nlwrote in message
>>Can't you give <pa class and hide the lot via CSS in the product where
you do not want to show this advanced help? It would remove all
occurrences via one simple parameter.
[...]
<style>
p.advanced {visible=no} // or {visible=yes} I am guessing here; check the
styles applicable to <p>
</style>
If you are *this* sure, please refrain from posting your code in the future.
This does not even come close to CSS. Should be:

<style type="text/css">
p.advanced {
display: none;
}
</style>
<p class=advanceda ll text here will not show unless you change the
stylesheet</p>
All attribute values should be quoted.
PointedEars
--
var bugRiddenCrashP ronePieceOfJunk = (
navigator.userA gent.indexOf('M SIE 5') != -1
&& navigator.userA gent.indexOf('M ac') != -1
) // Plone, register_functi on.js:16
Jun 27 '08 #8

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

12
6559
by: Kevin Lyons | last post by:
Hello, I am trying to get my select options (courses) passed correctly from the following URL: http://www.dslextreme.com/users/kevinlyons/selectBoxes.html I am having difficulty getting the courses to pass the correct option value and then be displayed at the following URL: http://www.dslextreme.com/users/kevinlyons/selectResults.html I am passing countries, products, and courses. The first two display
19
6934
by: dmiller23462 | last post by:
Hi guys....I have absolutely NO IDEA what I'm doing with Javascript but my end result is I need two text boxes to stay hidden until a particular option is selected....I've cobbled together the JavaScript in this code from a couple different sites but I'm not 100% sure what each line is doing...This is the ASP code that I'm using for the page....Take a look at the JavaScript code and please let me know what each line is doing....I have been...
1
14546
by: Oliver Hoehle | last post by:
Hello! This ist the source-code for an editable combobox implemented with HTML,CSS and Javascript. I have tested it with IE and Mozilla. But I don't know, if it will work in other browsers (Opera, Konqueror, etc.) So I need your feedback... Regards
7
2446
by: fernandoronci | last post by:
Hi, I've been given the task of mantaining and fixing a website which I didn't design. I'm using Internet Explorer 5.5 and 6.x. Specifically, the problem is that navigation menues (written in javascript) don't disappear when the mouse moves outside of the area of the menues (some of the menues are nested two and three levels). As long as the mouse cursor remains *within* the options of the menues, the option under the mouse cursor is...
7
1822
by: f1crazed | last post by:
Ok, The following html works wonderful in IE. It does not work in FireFox. Can someone please tell me the work around for FireFox to get this to work. HTML DOCUMENT: <html> <head> <title>CSS Z-order Test</title> <script language=Javascript>
20
1467
by: Shang Wenbin | last post by:
Hi, How to use javascript in php? I want to return some values to php. Thanks -- Shang Wenbin from Realss
4
1548
by: -Lost | last post by:
I cannot for the life of me remember the site name, but I believe it was the site of one of the regular posters here or perhaps in comp.lang.java.javascript. Anyway... The site in particular boasted about accessible JavaScript or proper JavaScript degradation, something along those lines. I remember specifically when I visited the site without JavaScript enabled it displayed the entire "menu" in a vertical fashion along the left side of...
2
3158
by: sorobor | last post by:
dear sir .. i am using cakephp freamwork ..By the way i m begener in php and javascript .. My probs r bellow I made a javascript calender ..there is a close button ..when i press close button then the calender gone actually i want if i click outside off the calender then it should me removed ..How kan i do this ... Pls inform me as early as possible .. I am waiting for ur quick replay ...Here i attached the source code .... <!DOCTYPE...
47
65418
by: SOLAV | last post by:
This is the only working way to completely hide your JavaScript code from the client just like PHP or ASP code. Here we'll need the help of PHP. Here is the code: index.php ________________________________________________________ <?PHP @session_start(); //Start our session. if(@!session_is_registered('PrintTheJavaScript')){ //If the session is not registered (and it's not). @session_register('PrintTheJavaScript'); //Register the...
0
9685
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
9533
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10461
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
1
10190
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
10019
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
9057
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
7555
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
6796
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
1
4122
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.