Jump to content

IF's not working...


clonetrooper9494

Recommended Posts

I have a JS script that writes in TD's and TR's in the middle of a table depending on if something's value is not ''... but for some reason, it's not wroking!(sorry about the \" it was in another funtion...)

<script type=\"text/javascript\">var t = document.getElementById('extra').value;var p = document.getElementById('addon').value;if(t == ''){document.write('')}else{document.write(p + t)}</script><textarea style=\"display:none\" id=\"addon\"></tr></td><tr><td><hr width=\"90%\"></td></tr><tr></textarea><textarea style=\"display:none\" id=\"extra\"></tr></td><tr><td><hr width=\"90%\"></td></tr><tr></textarea>

If you want to see it in action, go here (P.S. try right clicking!)An if you were wondering, this is my navigation script, and a page that needs an extra option on that menu just makes a little textbox called extra... but it doesn't work!

Link to comment
Share on other sites

Since your script works inline, you're trying to access 'extra' and 'addon' before they exist, since they don't get written till later. Ordinarily, you'd correct such a problem by putting the id references into an onload function, but the way you have things arranged, I'm not sure that'll work.Why do you want the values of the textareas before the textareas get written? Is this essential?(Oh, yeah. Hi, everybody. I'm new.)

Link to comment
Share on other sites

No, well maybe, if I add a script that puts this on every page, I should be able to... let me check......Thank you! that worked! that was the problem! I didn't think that was the problem... but atleast it works now!

Link to comment
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...