Go Back   CodingForums.com > :: Client side development > JavaScript programming > DOM and JSON scripting

Before you post, read our: Rules & Posting Guidelines

Reply
 
Thread Tools Rate Thread
Enjoy an ad free experience by logging in. Not a member yet? Register.
Old 03-08-2013, 02:18 PM   PM User | #1
Mr0000
New to the CF scene

 
Join Date: Mar 2013
Posts: 2
Thanks: 0
Thanked 0 Times in 0 Posts
Mr0000 is an unknown quantity at this point
JS document.writeln problem

Hello,

I have a simple question, but I can't find a answer to it.
In the index.php there is a javascript:

PHP Code:
 //document.writeln(<input type="button" name="submit" value="Submit">); 
and this JS is disabled, is there any way to call this JS in that page?

Thank you, for your help
Mr0000 is offline   Reply With Quote
Old 03-08-2013, 02:35 PM   PM User | #2
WolfShade
Regular Coder

 
Join Date: Apr 2012
Location: St. Louis, MO, USA
Posts: 960
Thanks: 7
Thanked 100 Times in 100 Posts
WolfShade is an unknown quantity at this point
Firstly, avoid document.write(ln). It's old, old, old. Create an HTML element (span or div or something), give it an ID, and use innerHTML (or jQuery .html()) to populate it after it's created.

Secondly, the // at the beginning of the line is commenting out that line. Remove that, and the line should be enabled. But, again, refer to my "Firstly" comment.
__________________
^_^

If anyone knows of a website that can offer ColdFusion help that isn't controlled by neurotic, pedantic jerks* (stackoverflow.com), please PM me with a link.
*
The neurotic, pedantic jerks are not the owners; just the people who are in control of the "popularity contest".
WolfShade is offline   Reply With Quote
Old 03-08-2013, 02:41 PM   PM User | #3
Mr0000
New to the CF scene

 
Join Date: Mar 2013
Posts: 2
Thanks: 0
Thanked 0 Times in 0 Posts
Mr0000 is an unknown quantity at this point
Quote:
Originally Posted by WolfShade View Post
Firstly, avoid document.write(ln). It's old, old, old. Create an HTML element (span or div or something), give it an ID, and use innerHTML (or jQuery .html()) to populate it after it's created.

Secondly, the // at the beginning of the line is commenting out that line. Remove that, and the line should be enabled. But, again, refer to my "Firstly" comment.
I know that it's a old way to do it.

But, I want to execute that Javascript remotely through my browser, without removing comment lines. Is that possible?
Mr0000 is offline   Reply With Quote
Old 03-08-2013, 03:06 PM   PM User | #4
WolfShade
Regular Coder

 
Join Date: Apr 2012
Location: St. Louis, MO, USA
Posts: 960
Thanks: 7
Thanked 100 Times in 100 Posts
WolfShade is an unknown quantity at this point
If the double-slash is preceeding it, no. It's commented out, the browser does not parse it.

If you need to set it so that it triggers on a button click or link click, place that inside a function and call the function using onclick="" attribute. But, then, that brings us back to the "Firstly" comment. document.write and document.writeln both will rewrite the whole page if executed after the page loads.

http://stackoverflow.com/questions/5...fter-page-load
__________________
^_^

If anyone knows of a website that can offer ColdFusion help that isn't controlled by neurotic, pedantic jerks* (stackoverflow.com), please PM me with a link.
*
The neurotic, pedantic jerks are not the owners; just the people who are in control of the "popularity contest".

Last edited by WolfShade; 03-08-2013 at 03:10 PM..
WolfShade is offline   Reply With Quote
Reply

Bookmarks

Jump To Top of Thread


Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

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

Forum Jump


All times are GMT +1. The time now is 11:23 AM.


Advertisement
Log in to turn off these ads.