Current location: Hot Scripts Forums » General Web Coding » JavaScript » whats wrong with this?


whats wrong with this?

Reply
  #1 (permalink)  
Old 11-17-04, 12:29 PM
FiRe FiRe is offline
Code Guru
 
Join Date: Oct 2004
Location: UK
Posts: 801
Thanks: 0
Thanked 0 Times in 0 Posts
whats wrong with this?

I am not really a javascript guru but here is my code:

Code:
function x(a1,a2,a3) {
var qu = prompt(a2);
document.compose.message.value = a1 + qu + a3;
}
Then I use:

Code:
<a onClick="javascript:x("<b>","Please enter text to make bold:","</b>")">Bold</a>
Any help why this wont work, it just says syntax error...?!
__________________
Alexa Share <-- Trade virtual shares in websites with this online game.

codR.us <-- Submit and vote for your favorite code snippets with codR.us.

XEWeb.net <-- The ultimate PHP resource network.
Reply With Quote
  #2 (permalink)  
Old 11-18-04, 12:57 AM
TwoD TwoD is offline
Community VIP
 
Join Date: Sep 2003
Location: 404
Posts: 1,813
Thanks: 0
Thanked 0 Times in 0 Posts
<a onClick="javascript:x("<b>","Please enter text to make bold:","</b>")">Bold</a>
should be <a onClick="javascript:x('<b>','Please enter text to make bold:','</b>')">Bold</a>

You can't nest "....
Reply With Quote
  #3 (permalink)  
Old 11-18-04, 04:45 AM
Sabu Sabu is offline
Junior Code Guru
 
Join Date: Sep 2004
Posts: 458
Thanks: 0
Thanked 0 Times in 0 Posts
Or in other words, try changing all the quotation marks within the main ones to apostrophes in the link.

Code:
<a onClick="javascript:x('<b>','Please enter text to make bold:','</b>')">Bold</a>
What it was doing was seeing the second " (after x) and closing the 'onclick' variable. Using apostrophes instead won't cut off the opening quotation mark until you want it to.
Reply With Quote
  #4 (permalink)  
Old 11-18-04, 02:30 PM
FiRe FiRe is offline
Code Guru
 
Join Date: Oct 2004
Location: UK
Posts: 801
Thanks: 0
Thanked 0 Times in 0 Posts
Ok I now get this error: 'object doesnt support this property or method' ??
__________________
Alexa Share <-- Trade virtual shares in websites with this online game.

codR.us <-- Submit and vote for your favorite code snippets with codR.us.

XEWeb.net <-- The ultimate PHP resource network.
Reply With Quote
Reply

Bookmarks


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
What is wrong with this script donkon PHP 3 10-28-04 02:36 AM
i think there is something wrong ?? shadi PHP 9 09-03-04 03:49 PM
PHP email script problems (bounces go to wrong address). MTO PHP 1 04-28-04 11:13 PM
What have I done wrong now??? DAL Perl 4 11-24-03 06:26 PM
something wrong with this code superman PHP 3 07-06-03 10:55 PM


All times are GMT -5. The time now is 10:36 PM.
vBulletin® Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.