What happened to the Messenger Plus! forums on msghelp.net?
Shoutbox » MsgHelp Archive » Skype & Technology » Tech Talk » JavaScript problem

JavaScript problem
Author: Message:
DragonX
Full Member
***

Avatar

Posts: 226
Reputation: 10
40 / Male / –
Joined: Aug 2005
O.P. JavaScript problem
Me again ;) this time i'm truely lost, i've searched google and found exactly what i need to do, but when i do it, it doesn't work. It goes as such..

code:
function quote(id) {
  var username = eval("document.quote.q"+id+".value");
  document.inputform.message.value += quote\r\n;
  document.inputform.message.focus();
}

code:
<form method='post' name='inputform' onsubmit='return checkForm(this)'>
    <textarea name='message' rows='10' cols='50'</textarea>
</form>


Now all works fine, i can get the info out of qid and show it in an alert fine, my problem comes with the other two js statements.

1. It won't put the text in the textarea.
2. when doing focus(), IE says "Object doesn't support this property method"

So am at a loss right now :S
[Image: dsd-mi_616175.png]
12-03-2005 09:15 PM
Profile E-Mail PM Web Find Quote Report
WDZ
Former Admin
*****

Avatar

Posts: 7106
Reputation: 107
– / Male / Flag
Joined: Mar 2002
RE: JavaScript problem
quote:
document.inputform.message.value += quote\r\n;
What is "quote" supposed to be? I don't see any variable by that name defined. Also, \r\n is a string, so it needs to be enclosed in quotation marks. Something like this would probably work...

document.inputform.message.value += username+"\r\n";
quote:
<textarea name='message' rows='10' cols='50'</textarea>
You're missing a ">" in there.
12-04-2005 07:24 AM
Profile PM Web Find Quote Report
ShawnZ
Veteran Member
*****

Avatar

Posts: 3146
Reputation: 43
32 / Male / Flag
Joined: Jan 2003
RE: JavaScript problem
Also, use IDs and document.getElementById() instead of NAME.
Spoiler:
the game.
the game.
the game.
the game.
the game.
the game.
the game.
the game.
the game.
the game.
the game.
the game.
the game.
the game.
the game.
the game.
the game.
the game.
the game.
the game.
the game.
the game.
the game.
the game.
the game.
the game.
the game.
the game.
the game.
the game.
the game.
the game.
12-04-2005 01:30 PM
Profile PM Web Find Quote Report
-dt-
Scripting Contest Winner
*****

Avatar
;o

Posts: 1819
Reputation: 74
35 / Male / Flag
Joined: Mar 2004
RE: JavaScript problem
quote:
Originally posted by ShawnZ
Also, use IDs and document.getElementById() instead of NAME.
:P why.... he may want to submit the form and its easier to do it like that?
and then i hear you shout XPCNativeWrappers well he could just use
document.forms.namedItem("inputform").elements.namedItem("message").value

This post was edited on 12-04-2005 at 01:53 PM by -dt-.
[Image: dt2.0v2.png]      Happy Birthday, WDZ
12-04-2005 01:42 PM
Profile PM Web Find Quote Report
DragonX
Full Member
***

Avatar

Posts: 226
Reputation: 10
40 / Male / –
Joined: Aug 2005
O.P. RE: JavaScript problem
oops, ok, here that block of code again
code:

function quickquote(pid) {
  if(qqsel != "" && qqsel.indexOf("[quote]") == -1) {
    var quote = qqsel;
  } else {
    var quote = eval("document.quickquote.qq"+pid+".value");
  }
  qqsel = "";
  var username = eval("document.quickquote.qq"+pid+".value");
  alert(quote);
  document.quickreplyform.message.value += "[quote="+username+"]"+quote+"[/quote]\r\n";
  document.quickreplyform.message.focus();
}


this is all in a html .tpl file btw.

This post was edited on 12-04-2005 at 03:03 PM by DragonX.
[Image: dsd-mi_616175.png]
12-04-2005 02:59 PM
Profile E-Mail PM Web Find Quote Report
« Next Oldest Return to Top Next Newest »


Threaded Mode | Linear Mode
View a Printable Version
Send this Thread to a Friend
Subscribe | Add to Favorites
Rate This Thread:

Forum Jump:

Forum Rules:
You cannot post new threads
You cannot post replies
You cannot post attachments
You can edit your posts
HTML is Off
myCode is On
Smilies are On
[img] Code is On