Jump to content

IF's not working...


clonetrooper9494
 Share

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

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

×
×
  • Create New...