HighDots Forums  

Problem with calling a function within a newly created element

Javascript JavaScript language (comp.lang.javascript)


Discuss Problem with calling a function within a newly created element in the Javascript forum.



Reply
 
Thread Tools Display Modes
  #21  
Old   
DL
 
Posts: n/a

Default Re: Problem with calling a function within a newly created element - 05-19-2008 , 09:24 PM






Quote:
select id="qType"+i name="qType"+i *onchange="doCheckbox('+i
+','+nextrow+')"><option value="YN" selected>Yes/No<option
value="CK">Checkbox<option value="RD">Radio</select

// silly me, the form wasn't sent, how to expect an element of it?
// now, I only need this SELECT element for the doCheckbox function,
could I re-write the above code to
select id="qType"+i name="qType"+i
onchange="doCheckbox(this.value,'+i+','+nextrow+') "><option value="YN"
selected>Yes/No<option value="CK">Checkbox<option value="RD">Radio</
select
to pass the SELECT element's value along?
ok, the most desirable thing is to either send or somehow be able to
retrieve the newly populated value of the SELECT element from the
doCheckbox function. And if this option is a no go, send the whole
form? onchange="doCheckbox(form.submit(),'+i+','+nextrow +')"> //
won't work
// it's about 10:24pm here, am I getting real slow?

Thanks.


Reply With Quote
  #22  
Old   
Thomas 'PointedEars' Lahn
 
Posts: n/a

Default Re: Problem with calling a function within a newly created element - 05-20-2008 , 03:46 AM






DL wrote:
^^^^^^^^^
This is an attribution line. Again, please include one next time.

Quote:
Thanks. But I ran into a problem.

var qt = 'qType'+i; alert(qt);
// so far so good, it generates a valid value of the SELECT element's
id;
As you have been told before, code should be posted so that it has good
chances to remain executable when copypasted, after being line-broken.
Therefore, single-line comments should appear *before* the code they
describe, and if they are long enough, multi-line comments /* ... */
should be used instead.

Quote:
var selectelement = document.getElementById(qt);
alert(selectelement);
// not good, it generates null value, hence, next step also failed.

Could the "pointed ear something" mess up my
browser (his/her javascript expertise is at a level to do something
like that)?
So now you're blaming the result of your stupidity on the expertise of
others? (It's _he_ BTW, Thomas isn't a name you would give to a girl,
now is it?) :-(

Quote:
[...] your explanation seems to indicate that there _isn't_ an element
with the ID you expect.

Ahe. I know where the problem is... maybe... Here's the code for this
portion,

select id="qType"+i name="qType"+i onchange="doCheckbox('+i
If an HTML parser were to parse this, it would read either

<select id="qType" name="qType" onchange="doCheckbox('+i

or

<select id="qType&quot;+i" name="qType&quot;+1" onchange="doCheckbox('+i

In the first case the element would not have the ID that you expect it to
have; in the second case the result is invalid as IDs must not contain the
`+' character. But see below.

Quote:
+','+nextrow+')"><option value="YN" selected>Yes/No<option
value="CK">Checkbox<option value="RD">Radio</select

// silly me, the form wasn't sent, how to expect an element of it? //
now, I only need this SELECT element for the doCheckbox function, could I
re-write the above code to <select id="qType"+i name="qType"+i
onchange="doCheckbox(this.value,'+i+','+nextrow+') "><option value="YN"
selected>Yes/No<option value="CK">Checkbox<option value="RD">Radio</
select> to pass the SELECT element's value along?

My test indicates no. Then how?
You have posted invalid HTML. Assuming in your favor that the code is a
string value that is the argument of document.write() or something like that
instead, you have forgotten to escape `</' (End TAG Open delimiter) as `<\/'
within that string.

Quote:
Unfortunately the other viable alternative of using Firefox with Firebug
isn't available at this point. A company called Aka??? embeded encrypted
code (probably to track what's going on with my FF usage),
What the heck are you talking about? Do you want to be a serious software
developer, or do you want to be a script kiddie?

Quote:
but that's none of their f??? business and I cursed them publicly, and
they are security experts, now, my FF is hardly working, let alone the
powerful Firebug debugging feature). Trying the lame re- installation to
no avail...
Maybe you should someone let do the job who knows what they are doing.


PointedEars
--
Anyone who slaps a 'this page is best viewed with Browser X' label on
a Web page appears to be yearning for the bad old days, before the Web,
when you had very little chance of reading a document written on another
computer, another word processor, or another network. -- Tim Berners-Lee


Reply With Quote
  #23  
Old   
DL
 
Posts: n/a

Default Re: Problem with calling a function within a newly created element - 05-20-2008 , 01:11 PM



Quote:
Unfortunately the other viable alternative of using Firefox with Firebug
isn't available at this point. A company called Aka??? embeded encrypted
code (probably to track what's going on with my FF usage),
What the heck are you talking about? Do you want to be a serious
software
developer, or do you want to be a script kiddie?

Quote:
but that's none of their f??? business and I cursed them publicly, and
they are security experts, now, my FF is hardly working, let alone the
powerful Firebug debugging feature). *Trying the lame re- installationto
no avail...

Maybe you should someone let do the job who knows what they are doing.

PointedEars
--
Fk off, you m fker for the last time on your m's grave! I've asked
you to do so repeatedly in private but you did not listen, so, I have
to publicly! Once again, you m fker, fk off!!!!


Reply With Quote
Reply




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

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off



Powered by vBulletin Version 3.5.4
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.