-5

my code keeps saying this "Unterminated regular expression literal. (line 5, file "Code")" pls help here is what I have:

<FORM>
</INPUT TYPE="button" 
VALUE="click here to add a game"
onClick="parent.location='mailto:1637206@student.ucps.k12.nc.us?subject=I would like to add a game to the website'">
</FORM>

2 Answers2

3

You have your opening tag starting with a forward slash and no closing tag.

<FORM>
<INPUT TYPE="button" 
VALUE="click here to add a game"
onClick="parent.location='mailto:1637206@student.ucps.k12.nc.us?subject=I would like to add a game to the website'"/>
</FORM>

Start with <Input then terminate the tag with />

Wobbles
  • 3,033
  • 1
  • 25
  • 51
  • Input is just `` or ``, not ` ... ` – Alexander O'Mara Apr 12 '16 at 22:26
  • so i should delete the word "form" on both sides and just start with "< input"? – Andrew Goodson Apr 12 '16 at 22:28
  • @AndrewGoodson, no, nobody said to touch the form tag. – Wobbles Apr 12 '16 at 22:31
  • @AlexanderO'Mara As far as I know, to keep with the HTML5 standard all tags should be closed and none should be left singular open. – Wobbles Apr 12 '16 at 22:31
  • HTML5 does not require single tags to be closed for void elements. XHTML requires self-closing single tags (ie. ``). There is no opening-and-closing form of `input`. See [How to close tag properly?](http://stackoverflow.com/questions/14860492/how-to-close-img-tag-properly) – Alexander O'Mara Apr 12 '16 at 22:35
  • @AlexanderO'Mara I see you are correct, especially in the case of the Input tag. Have made the change to my answer. Im still in WPF mode. – Wobbles Apr 12 '16 at 22:37
0

As Wobbles already answered, the syntax of your INPUT element is invalid.

However, 'mailto:1637206@student.ucps.k12.nc.us?subject=I would like to add a game to the website' is also invalid because you have spaces in the value for the parameter subject: It would be parsed as subject=I followed by gibberish which the parser wouldn't understand; You need to encode special characters for it to be parsed reliably:

Make sure you encode all special characters. Common character encodings are below, or you can use Eric Meyer’s URL encoder tool. If you would rather learn what all the character encodings are, you can use this resource.

Common character encodings

  • space = %20 or + (either one works)
  • line break / carriage return = %0D%0A
  • question mark = %3F / (forward slash) = %2F : (colon) = %3A

You do not need to encode commas (,) or periods (.).

Community
  • 1
  • 1
errantlinguist
  • 3,658
  • 4
  • 18
  • 41
  • 1
    Though from a standpoint of good practice you should encode the url, it is not necessary. Most if not all modern browsers will handle the string just fine as it is. – Wobbles Apr 12 '16 at 22:36
  • Ah, okay. I haven't dealt with this stuff in quite a while, so I guess things are better now than they were back then ;) – errantlinguist Apr 12 '16 at 22:38
  • I HAVE DONE WHAT U SAID BUT NOW IT SAYS "Illegally formed XML syntax. (line 6, file "Code")" HERE LOOK:myFunction
    ; TYPE="button" VALUE="click here to add a game" onClick="parent.location='mailto:1637206@student.ucps.k12.nc.us?subject=I would like to add a game to the website'">
    – Andrew Goodson Apr 12 '16 at 23:06
  • myFunction
    ; TYPE="button" VALUE="click here to add a game" onClick="parent.location='mailto:1637206@student.ucps.k12.nc.us?subject=I would like to add a game to the website'">
    – Andrew Goodson Apr 12 '16 at 23:08
  • @AndrewGoodson Did you even look at the answer or the code? What I posted is nothing remotely like what you are posting.... – Wobbles Apr 12 '16 at 23:10
  • @AndrewGoodson Not to mention you aren't even commenting on the right answer..... – Wobbles Apr 12 '16 at 23:11
  • OK IM SORRY BUT...CAN YOU JUST WRITE THE CODE FOR ME..whoops caps..I just learned java and still am learning some so yea can u write the code and paste it..sorry – Andrew Goodson Apr 12 '16 at 23:13
  • to the first answer? – Andrew Goodson Apr 12 '16 at 23:17
  • Just look at [Wobbles' answer](http://stackoverflow.com/a/36585085/1391325): It works. *Please*. – errantlinguist Apr 13 '16 at 14:16
  • thanks guys sorry for causing u trouble im only 14 and learning to code – Andrew Goodson Apr 13 '16 at 14:34
  • The first and most important part of learning is defining very well what you want to learn/know... Only then can you go about learning it. Moreover, sometimes simply defining the question helps you find out the answer. – errantlinguist Apr 13 '16 at 14:38
  • P.S. If [Wobbles' answer](http://stackoverflow.com/a/36585085/1391325) worked for you (which it does), it's best to [accept it](https://stackoverflow.com/help/accepted-answer) because not only does he get more reputation points but also you. – errantlinguist Apr 13 '16 at 15:00