Hi,
I am using the following javascript method inside a js file.
function createDivRow(la bel,text) {
var formedTd = '<tr><td>' + label + '</td><td> <a href="#" onclick="javasc ript:eventHandl erFunction("'+t ext+'")">'+text +'</a></td></tr>';
return formedTd;
}
But it's throwing syntax error.
I have tried the following way also.
function createDivRow(la bel,text) {
var formedTd = '<tr><td>' + label + '</td><td> <a href="#" onclick="javasc ript:eventHandl erFunction('+te xt+')">'+text+' </a></td></tr>';
return formedTd;
}
this version throwing ')' expected and also, the value of text which i am passing dynamically is undefined.
I am not able to call the eventHandlerFun ction() by passing the dynamic value of the 'text' .
I am using IE6. can any one help me....
6 2027 gits 5,390
Recognized Expert Moderator Expert
hi ...
try this: -
var formedTd = '<tr><td>'
-
+ label
-
+ '</td><td> <a href="#" onclick="javascript:eventHandlerFunction("'
-
+ text
-
+ '")">'
-
+ text
-
+ '</a></td></tr>';
-
the problem should be your linebreak before 'onclick'
kind regards ...
hi ...
try this: -
var formedTd = '<tr><td>'
-
+ label
-
+ '</td><td> <a href="#" onclick="javascript:eventHandlerFunction("'
-
+ text
-
+ '")">'
-
+ text
-
+ '</a></td></tr>';
-
the problem should be your linebreak before 'onclick'
kind regards ...
Hi...
Thanks for your reply. I am still getting the syntax error...:(
gits 5,390
Recognized Expert Moderator Expert
... when trying this in FF & IE it works for me ...
[HTML]<body>
<script>
var label = 'test';
var text = 'test1';
var formedTd = '<tr><td>'
+ label
+ '</td><td> <a href="#" onclick="javasc ript:eventHandl erFunction("'
+ text
+ '")">'
+ text
+ '</a></td></tr>';
alert(formedTd) ;
</script>
</body>
[/HTML]
please post your code that is not working ...
kind regards ...
gits 5,390
Recognized Expert Moderator Expert
ahhhhhhhhhh ... got your problem ... you put the formedTd-string in an HTML-page and you want the function called ... ;) of course ...
you must escape the quotes and single quotes of course ... sorry that i forgot it ... use the following: -
var formedTd = '<tr><td>'
-
+ label
-
+ '</td><td> <a href="#" onclick="javascript:eventHandlerFunction(\''
-
+ text
-
+ '\')">'
-
+ text
-
+ '</a></td></tr>';
-
but note ... that assumes that text is a string passed to your eventHandlerFun ction ... otherwise you should delete the both escaped quotes
kind regards
ahhhhhhhhhh ... got your problem ... you put the formedTd-string in an HTML-page and you want the function called ... ;) of course ...
you must escape the quotes and single quotes of course ... sorry that i forgot it ... use the following: -
var formedTd = '<tr><td>'
-
+ label
-
+ '</td><td> <a href="#" onclick="javascript:eventHandlerFunction(\''
-
+ text
-
+ '\')">'
-
+ text
-
+ '</a></td></tr>';
-
but note ... that assumes that text is a string passed to your eventHandlerFun ction ... otherwise you should delete the both escaped quotes
kind regards
yeah...,with the single quote escapes, it's working now...
Thanks a lot for your help.I tried different ways of calling that function with the dynamic value of 'text'.But nothing helped me. I am really thankful to you...:)
gits 5,390
Recognized Expert Moderator Expert
glad to help you ... come back when you have more questions ... ;)
kind regards ...
Sign in to post your reply or Sign up for a free account.
Similar topics |
by: Kevin Lyons |
last post by:
Hello,
I am trying to get my select options (courses) passed correctly from
the following URL: http://www.dslextreme.com/users/kevinlyons/selectBoxes.html
I am having difficulty getting the courses to pass the correct option
value and then be displayed at the following URL:
http://www.dslextreme.com/users/kevinlyons/selectResults.html
I am passing countries, products, and courses. The first two display
|
by: Holger Butschek |
last post by:
Hi folks,
first of all, I'm absolutly new to javascript. I have designed a html-form
and am trying to path parameters with the suffix of i.e.
?Seminartitel=hallowelt in the url.
In the head of the called page I put the following script (I found it some
where, many thanks to him):
<script language="JavaScript">
|
by: danny.myint |
last post by:
I was under the assumption that javascript loads all the <head></head>
elements before processing the <body> tag in Mozilla/Netscape/Firefox.
It doesn't seem like it, with my problem.
I have navigation that has onMouseOver and onMouseOut triggers, that
use function calls in my external .js file. When I mouseOver a button
in my navigation quickly enough to catch it before the rest of the body
loads, it returns a function "not defined"...
|
by: 63q2o4i02 |
last post by:
Hi,
I'm writing a hand-written recursive decent parser for SPICE syntax
parsing. In one case I have one function that handles a bunch of
similar cases (you pass the name and the number of tokens you're
looking for). In another case I have a function that handles a
different set of tokens and so it can't use the same arguments as the
first one, and in fact takes no arguments. However, these functions
are semantically similar and are...
|
by: johnjsforum |
last post by:
Buddies,
I have a web page to create HTML buttons dynamically as in the “formDivColorPicker” function
//////////////////////////////////////////////////////////////////////////////////// version 1 : using global variables //////////////////////////////////////////////////////////////////
var _textField, _divColorPicker; // global vars
window.onload = function()
{
_textField = document.getElementById('htxaMessage'); // fill...
| |
by: modermo |
last post by:
Hey
new to javascript
figuring out how to fix this darn problem. I employ an image rollover, and it works beautifully in safari. But in firefox, the image has an annoying blue border around it, which i didnt specify. Further to that, when I click it, it should lead straight into another site/window. But when i click it, another totally irrelevant image pops up. Its only when i click it again that it the link takes me to another site.
...
|
by: xNephilimx |
last post by:
lHi guys!
I'm having a little problem that's getting on my nerves, I couldn't find a solution, I also tryed googling it and I found nothing... (my field of expertise is in AS 2 and 3, but I still lack some JavaScript solid knowdlege)
The problem is that when I try to send a form's content with Ajax (I'm using the prototype library), for some reason the latin characters (accents and stuff, like áéíóú) turn a mess when I try to store them in...
|
by: q-rious |
last post by:
Hello All,
1. I would like to pass some variables (x and y below) from Javascript
to PHP, process them in PHP, and return some other variables (a abd b)
back to Javascript.
--(x,y)-- --(a,b)--
2. The variables x and y are not known to HTML directly, so I can not
pass them to PHP as:
|
by: avpkills2002 |
last post by:
I seem to be getting this weird problem in Internet explorer. I have
written a code for parsing a XML file and displaying the output. The
code works perfectly fine with ffx(Firefox).However is not working in
Internet Explorer.(I m using Internet Explorer 6.0). The code is as
follows:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://
www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html...
|
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, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look !
Part I. Meaning of...
|
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 effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it.
First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
| |
by: Oralloy |
last post by:
Hello folks,
I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>".
The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed.
This is as boiled down as I can make it.
Here is my compilation command:
g++-12 -std=c++20 -Wnarrowing bit_field.cpp
Here is the code in...
|
by: jinu1996 |
last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth.
The Art of Business Website Design
Your website is...
|
by: Hystou |
last post by:
Overview:
Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
|
by: agi2029 |
last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own....
Now, this would greatly impact the work of software developers. The idea...
|
by: conductexam |
last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one.
At the time of converting from word file to html my equations which are in the word document file was convert into image.
Globals.ThisAddIn.Application.ActiveDocument.Select();...
|
by: 6302768590 |
last post by:
Hai team
i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
| |
by: bsmnconsultancy |
last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...
| |