Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations IamaSherpa on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Stopping Browser Interp. of HTML

Status
Not open for further replies.

keyer

Programmer
Aug 21, 2000
18
US
How can I prevent the browser from interpreting the html that follows a Javascript function if a certain condition applies?

<script language='JavaScript'>
<!--
function cookiesEnabled() {
if (! document.cookie()) {
document.write(&quot;some message&quot;);
<!-- something to stop all that follows from executing -->
}

cookiesEnabled();
}
-->
</script>

<!-- HTML or PHP code here -->
 
you can't.

if you're trying to prevent something from being displayed, then perhaps you can hide it in a <div style=&quot;display:none;&quot;>, however the source HTML will still be available to anyone keen enough to look.

=========================================================
while (!succeed) try();
-jeff
 
if you were referring simply to the Javascript code within that function you have such a thing as return; which stops the function from going any further. Gary Haran
 
I don't mind people viewing the HTML, but I don't want to rely on style classes, and wonder what browsers aren't supporting it.

So I restructured everything so that it looks ok for it to fall through to the HTML after the JS function finishes.

Thanks for the help.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top