Closed Thread Icon

Preserved Topic: Variable Craziness... (Page 1 of 1) Pages that link to <a href="https://ozoneasylum.com/backlink?for=7809" title="Pages that link to Preserved Topic: Variable Craziness... (Page 1 of 1)" rel="nofollow" >Preserved Topic: Variable Craziness... <span class="small">(Page 1 of 1)</span>\

 
Relain
Paranoid (IV) Inmate

From: westernesse
Insane since: Jul 2000

posted posted 08-20-2001 12:12

simple question i think. for the script im using i have to put the HTML content for the webpage as variables inside the script. Im kind of confused about what kind of ' or " i should
be using to enclose my content... i.e if i wanted to use this

var duncan = "<a href='#' onClick='window.open("http://accelerator.dl.ac.uk/staff/scott/","staff");' >Duncan Scott</a>"

it doesn't seem to be able to cope with the nested alternating " thingies, you follow what i mean?

: : Relain : ;

mr.maX
Maniac (V) Mad Scientist

From: Belgrade, Serbia
Insane since: Sep 2000

posted posted 08-20-2001 13:43

You should escape double quotes with slash \, like this:

maxVar = "bla bla \"tra la la\" bla bla";

Relain
Paranoid (IV) Inmate

From: westernesse
Insane since: Jul 2000

posted posted 08-20-2001 14:49

ah Mr Max you have once again saved my sanity. how can i ever repay you? seriously who could ask for more, replies ,within hours of posting, which actually work

EDIT: Whats even cooler is that im now a maniac. wicked

[This message has been edited by Relain (edited 08-20-2001).]

Slime
Lunatic (VI) Mad Scientist

From: Massachusetts, USA
Insane since: Mar 2000

posted posted 08-20-2001 19:24

An important note:

HTML is not supposed to support single quotes (') whereas JavaScript *is* supposed to support it. Granted, most browsers will understand single quotes in HTML, but you should use double quotes there. So I'd change your line of code to:

var duncan = '<a href="#" onClick="window.open(\'http://accelerator.dl.ac.uk/staff/scott/\',\'staff\');">Duncan Scott</a>';

« BackwardsOnwards »

Show Forum Drop Down Menu