This is buggin me out

Results 1 to 3 of 3

Thread: This is buggin me out

  1. #1
    Joel M Guest

    Default This is buggin me out

    I am trying to make a client side script that will write a button with information that is passed through some parameters in a "simple" function, and when you click on it, it&#039ll print it out in an alert...but whenever the function runs, I get a javascript error that says that it&#039s an "unterminated string constant"<BR>the thing that bugs me out is that in trouble shooting this, I put an alert right before the button that calls that exact same information, and it displays just fine. hopefully I&#039ve explained it correctly, but I&#039m sure you can look at the script and figure out it&#039s purpose:<BR><BR>function account(acc, name, pass) {<BR><BR>alert(&#039hi &#039+name+&#039&#039);<BR><BR>data = "&#060;input type=&#039button&#039 value="+acc+" onClick=alert(&#039hi &#039+name+&#039&#039)&#062;";<BR><BR>document.wri te(data);<BR><BR>}<BR><BR>the button does display on the page, and the name on the button does show up correctly...but then it gets that error.<BR>if someone can look at this I would really appreciate it<BR>thanx

  2. #2
    Join Date
    Dec 1969

    Default RE: This is buggin me out

    The way to see the problem is do an alert(data). What&#039s happening is the onClick event needs to enclosed in quotes when written to the document... so, do something like the following (the is the escape character):<BR><BR>data = "&#060;input type=\"button\" value=\"" + acc + "\" onClick=\"alert(&#039hi " + name + "&#039)\"&#062;";<BR><BR>Now, can you answer my Q write below yours?<BR>

  3. #3
    Joel M Guest

    Default You rock dude

    It worked like a freakin charm...<BR>sorry, I couldn&#039t answer your Q below...not much of a vbscript fact the only reason I use vbscript is because that&#039s how the webmonkey article (i&#039m sure you know the one) showed how to connect to the databse...but the second I learn how to do server side Jscript, I am so better (in my opinion) because the syntax is so similar to many other popular and very powerful languages like JAVA and C/C++, so when I ever get around to learning those, I&#039m halfway there.<BR><BR>*Shameless plug*<BR>hey, maybe you could check out my vbscript venture into ebusiness at<BR>any remarks as far as design improvement would be very welcome, you could email me comments at<BR>thanks G

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts