View Full Version : quick question


Mr_Black
08-02-2006, 02:30 AM
Just what do <!-- and //--> mean?

Note: They are used in javascript.

dolce shanti
08-02-2006, 02:32 AM
They're just used to add commentary to your page :) Only the person viewing the source will see it.

For example...

<!-- Below is the code for the left menu //-->

Mr_Black
08-02-2006, 02:36 AM
Ok,thanx.

Now another question.

If, and how, is it possible to make a big script that has many ifs and such. I can not get this to work

<script language="javascript" type="text/javascript">

browser=(navigator.appName)
b_version=(navigator.appVersion)
version=(parseFloat(b_version))

if((browser=="Microsoft Internet Explorer"))
{
browse=0
}
else
{
browse=1
}

if((screen.width!=1024) && (screen.height!=768))
{
screen=1
}

else
{
screen=0
}

if(screen=1)
{
screentext=This website was made using a screen resolution of 1024x768, if you encounter any \nproblems then simply change your screen resolution to 1024x768.
}

else if(screen=0)
{
browser=You web browser may not work, IE6 was used \nwhile testing this site so unforseen errors may occur in other browsers.
}

if((browse==1) && (screen==1))
{
var error=1
var screen=0
var browse=0
}
else
{
var error=0
}

if(error==1)
{
document.write(browser +"\n\nAlso...\n\n"+screentext);
window.location="?";
}
if(browse==1)
{
document.write(browser);
window.location="?";
}
if(screen==1)
{
document.write(screentext);
window.location="?";
}
if((error==0) && (screen==0) && (browse==0))
{
window.location="?";
}
</script>



PLEASE help, its driving me crazy. I have modified it many times, heres how it is now.

Douglas
08-02-2006, 03:30 AM
Actually the <!--; and the //--> are to block browsers that don't support javascript so they don't try to run the script. the // and /* */ are for comments :)

dolce shanti
08-02-2006, 03:41 AM
OH...drat! Sorry about that ;) Obviously I don't use javascript much...

Thanks for catching that, Douglas ;)

Mr_Black
08-02-2006, 10:08 AM
I have basically figured out that my variables are not storing correctly and causing problems. Does anyone know how to correctly do what I am doing, I want it to be so that if a certain thing is true it will then set the value of a variable. Then i want it to continue on with the rest of the script.

P.S. Thanks for the correction Douglas

Mr_Black
08-02-2006, 02:33 PM
I finally got it, just had to rewrite the whole thing and make a few major modifications. :)

Thanx for the replies to my other question

dolce shanti
08-02-2006, 02:45 PM
Whoo hoo! Glad you solved the problem :) Always a refreshing feeling.

jeyjack
08-02-2006, 05:10 PM
Just what do <!-- and //--> mean?

Note: They are used in javascript.
they are used for comments in some scripts. The creator decide if he want to put them or not