473,394 Members | 1,854 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,394 software developers and data experts.

Problem with "onClick" command

I have a prblem with the "onClick" command.
onClick="insert('<a href="URI">', '</a>')">

but this is not correct! why?
Maria
Jul 3 '07 #1
5 3664
Maria Sudderman wrote on 03 jul 2007 in comp.lang.javascript:
I have a prblem with the "onClick" command.
onClick="insert('<a href="URI">', '</a>')">

but this is not correct! why?
What kind of function is insert(), javascript????
--
Evertjan.
The Netherlands.
(Please change the x'es to dots in my emailaddress)
Jul 3 '07 #2
d d
Maria Sudderman wrote:
I have a prblem with the "onClick" command.
onClick="insert('<a href="URI">', '</a>')">
but this is not correct! why?
Maria
Nested quotes. Try this:

onClick="insert('<a href=\"URI\">', '</a>')">

~dd
Jul 3 '07 #3
On Jul 3, 5:12 pm, d d <dd_no_s...@please.netwrote:
Nested quotes. Try this:

onClick="insert('<a href=\"URI\">', '</a>')">
The improper nesting is causing problems at the HTML parsing level,
not the JS level.

onclick="insert('<a href=&quot;URI&quot;>', '</a>')">

.... although I would avoid any JavaScript that accepted raw markup as
input.

--
David Dorward

Jul 3 '07 #4
thanks, this is the answer

"David Dorward" <do*****@gmail.comschrieb im Newsbeitrag
news:11**********************@q69g2000hsb.googlegr oups.com...
On Jul 3, 5:12 pm, d d <dd_no_s...@please.netwrote:
Nested quotes. Try this:

onClick="insert('<a href=\"URI\">', '</a>')">
The improper nesting is causing problems at the HTML parsing level,
not the JS level.

onclick="insert('<a href=&quot;URI&quot;>', '</a>')">

.... although I would avoid any JavaScript that accepted raw markup as
input.

--
David Dorward
Jul 3 '07 #5
d d wrote:
Maria Sudderman wrote:
>I have a prblem with the "onClick" command.
onClick="insert('<a href="URI">', '</a>')">
but this is not correct! why?
Maria

Nested quotes. Try this:

onClick="insert('<a href=\"URI\">', '</a>')">
In the context of a javascript string literals appearing in an HTML
attribute value it would be safer to transform the inner quotes into
Unicode or hex escape sequences as that renders them unrecognisable to
the HTML parser:-

onclick="insert('<a href=\x22URI\x22>', '</a>')">
-or:-
onclick="insert('<a href=\u0022URI\u0022>', '</a>')">

Richard.

Jul 3 '07 #6

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

6
by: Yvan J. Gagnon | last post by:
I am currenly developing a web site using Macromedia fireworks, and am trying to figure out a way (through hand-coding) of attaching a javascript function (onClick="doit=false") to each of the...
10
by: Eric-Sebastien Lachance | last post by:
Hey there, I decided to just create a 100% height and width div that filled the space over a background header image, and add an onclick event to redirect to the my index... Doesn't seem to work...
5
by: johnsuth | last post by:
I want to produce a trivial demonstration of dynamic modification. I thought that pressing a button might change its color. I studied O'Reillys books and successfully created the button with a...
2
by: Vincent van Beveren | last post by:
Hey everyone, I've looked for this and I wouldn't know what the best practice would be for solving the following problem. We use a BASE tag in our HTML pages. Now we have some links that use...
2
by: bay_dar | last post by:
Hi, I have an internal ASP.NET application that I'm are using to send e-mails out based on a single milepost or milepost range entered. I'm trying to do two things when a user clicks on the...
13
by: alvin.yk | last post by:
Hi, Normally, a piece of code such as <a href="http://www.yahoo.com" onclick="alert('hello');return false;">link</a> will stop the browser from actually going to href's destination....
4
by: thaytu888888 | last post by:
Here is my codes in aspx page: <td colspan="2" class="main_menu" runat="server" onclick='toggleDisplay(<%#Eval("description")%>);'><%#Eval("description")%></td> Here is in "View source": ...
2
by: ejrfigueiredo | last post by:
Hi, Is there a way to get a script function to save a page without the execCommand (which works on IE but doesn't on Firefox). Below there's the code I'm using, I took it from a template page...
5
by: dangt85 | last post by:
Hello, I have the following page: ... <style type="text/css"> body { font-family: Verdana, Arial, Helvetica, sans-serif; font-size: 12px; }
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.