Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>Well, before we even start trying to work through how the if statements are going to work, we need to fix the fact that you are <strong>assigning</strong> not <strong>comparing</strong> in your if() statements.</p> <p>Rather than have a single = sign in your if statements you need to have 2 equal signs. Like this:</p> <pre><code>if (site_type == website) </code></pre> <p>A single = sign is used to assign variables, so in your case you're actually assigning the value of website into the variable of site_type - not comparing the two seperate values.</p> <p>Try this:</p> <pre><code>function show_prompt() { var site_type = prompt("What kind of link is this?"); var site_url = prompt("What is the URL?"); var site_title = prompt("Give the link a title"); if (site_type == "website") { document.write("&lt;a style=\"color: #777777\" href=\"http:\/\/"+site_url+"\" title=\"site_title\"&gt;"+site_title+"&lt;\/a&gt;"); } if (site_type == "video") { document.write("&lt;a style=\"color:#98B2C3\" href=\"http:\/\/"+site_url+"\" title=\"site_title\"&gt;"+site_title+"&lt;\/a&gt;"); } if (site_type == "image") { document.write("&lt;a style=\"color:#8D5359\" href=\"http:\/\/"+site_url+"\" title=\"site_title\"&gt;"+site_title+"&lt;\/a&gt;"); } if(site_type == "article") { document.write("&lt;a style=\"color:#768D53\" href=\"http:\/\/"+site_url+"\" title=\"site_title\"&gt;"+site_title+"&lt;\/a&gt;"); } } </code></pre> <p>I've made a few changes to your code in the above chunk, not just removing the else statements. I've also made the if() comparisons check against strings rather than against empty variables as you had before and I've changed the document.write functions to use the added prompt strings in them. If we can get that to work, we can start thinking about where we <strong>really</strong> want to put the else statements at a later date :)</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
    2. VO
      singulars
      1. This table or related slice is empty.
    3. VO
      singulars
      1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload