homepage Welcome to WebmasterWorld Guest from
register, free tools, login, search, pro membership, help, library, announcements, recent posts, open posts,
Pubcon Gold Sponsor 2015!
Home / Forums Index / Code, Content, and Presentation / JavaScript and AJAX
Forum Library, Charter, Moderator: open

JavaScript and AJAX Forum

JavaScript Help for a newbie

WebmasterWorld Senior Member 5+ Year Member

Msg#: 3673037 posted 2:20 pm on Jun 12, 2008 (gmt 0)

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,



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

Msg#: 3673037 posted 2:36 pm on Jun 12, 2008 (gmt 0)

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.

Global Options:
 top home search open messages active posts  

Home / Forums Index / Code, Content, and Presentation / JavaScript and AJAX
rss feed

All trademarks and copyrights held by respective owners. Member comments are owned by the poster.
Home ¦ Free Tools ¦ Terms of Service ¦ Privacy Policy ¦ Report Problem ¦ About ¦ Library ¦ Newsletter
WebmasterWorld is a Developer Shed Community owned by Jim Boykin.
© Webmaster World 1996-2014 all rights reserved