Welcome to WebmasterWorld Guest from

Forum Moderators: open

Message Too Old, No Replies

JavaScript Help for a newbie



2:20 pm on Jun 12, 2008 (gmt 0)

WebmasterWorld Senior Member 5+ Year Member

OK all you people out there that are smarter than me I need some assistance. I'm fairly new to JavaScript and I have a problem. I have a form that runs an external php file via JavaScript when the user clicks a checkbox. The php files runs some checks on a few folders and displays output within a JavaScript alert box if needed. However, if all of my if statements check out I want to just display everything is fine, but not in an alert box just on the page. Basically I have a tag that looks like this;
<INPUT type="hidden" class = "message" STYLE="background-color: #339999; border: 0; color: white;" value = "Everything is Fine" />
Now what I want to do is use JavaScript or php (preferred) to change the value of that box to 'text'. Any help is appreciated. Thanks,


2:36 pm on Jun 12, 2008 (gmt 0)

WebmasterWorld Senior Member korkus2000 is a WebmasterWorld Top Contributor of All Time 10+ Year Member

In PHP you could just have an inline script in the html tag. I am not sure I understand why you are using a hidden field though. Why not have a hidden div that you change the CSS display property on?

<div id="errorNotice" style="display:none;">Everything is Fine</div>

Change the display property to block to have it show on the page. You can use a querystring variable or just print directly to the page a on off switch in the javascript code.

var aOK = <?php echo "1"?>;

You can put some if then logic in there to check for any variable you like in PHP. Then when they page is loaded in the browser PHP has printed the variable into the javascript.


Featured Threads

Hot Threads This Week

Hot Threads This Month