Current location: Hot Scripts Forums » General Web Coding » JavaScript » document.write() error


document.write() error

Reply
  #1 (permalink)  
Old 11-11-09, 10:27 AM
jonnekke jonnekke is offline
Code Guru
 
Join Date: Oct 2005
Location: holland!
Posts: 704
Thanks: 0
Thanked 0 Times in 0 Posts
document.write() error

Hi there...

I try to check if flash is installed on the site visitors computer.
The following script does this for me:

Code:
<script language="JavaScript" type="text/javascript">
        <!--
        // Version check based upon the values entered above in "Globals"
        var hasReqestedVersion = DetectFlashVer(requiredMajorVersion, requiredMinorVersion, requiredRevision);
        // Check to see if the version meets the requirements for playback
        if (hasReqestedVersion) {               
                document.write('FLASH DETECTED');
        } else {  // flash is too old or we can't detect the plugin
                document.write('NO FLASH DETECTED');
        }
        // -->
        </script>
        <noscript>
        GEEN FLASH
        </object>
        </a>
        </noscript>
The script doesn't work when I put tis in document.write:

HTML Code:
<div id="container">	
<div id="header_voetbal">
<object classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=10,0,0,0" width="980" height="400" id="topmenu" align="middle">
<param name="allowScriptAccess" value="sameDomain" />
<param name="allowFullScreen" value="false" />
<param name="movie" value="topmenu.swf" /><param name="quality" value="medium" /><param name="wmode" value="gpu" /><param name="bgcolor" value="#b6d2e0" />	<embed src="topmenu.swf" quality="medium" wmode="gpu" bgcolor="#b6d2e0" width="980" height="400" name="topmenu" align="middle" allowScriptAccess="sameDomain" allowFullScreen="false" type="application/x-shockwave-flash" pluginspage="http://www.adobe.com/go/getflashplayer_nl" />
</object>
</div>
</div>
What do I need to modify to make the text above apear with document.write(); ?

_j
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiShare on FacebookShare on Stumble UponShare on Twitter
Reply With Quote
  #2 (permalink)  
Old 11-11-09, 10:30 AM
Nico's Avatar
Nico Nico is offline
Community Leader
 
Join Date: Sep 2005
Location: Spain
Posts: 8,074
Thanks: 11
Thanked 88 Times in 83 Posts
Put all the HTML in one line, or use multiple document.write()s for each line.
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiShare on FacebookShare on Stumble UponShare on Twitter
Reply With Quote
  #3 (permalink)  
Old 11-11-09, 11:09 AM
jonnekke jonnekke is offline
Code Guru
 
Join Date: Oct 2005
Location: holland!
Posts: 704
Thanks: 0
Thanked 0 Times in 0 Posts
thnx nico!

it works.. but a new problem: how to write: <? include_once("../includes/navigatie.php"); ?>
or is this not possible?..
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiShare on FacebookShare on Stumble UponShare on Twitter
Reply With Quote
  #4 (permalink)  
Old 11-11-09, 11:12 AM
Nico's Avatar
Nico Nico is offline
Community Leader
 
Join Date: Sep 2005
Location: Spain
Posts: 8,074
Thanks: 11
Thanked 88 Times in 83 Posts
You have to use HTML entities.

< should become &lt;, > should become &gt;, and " becomes &quot;.
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiShare on FacebookShare on Stumble UponShare on Twitter
Reply With Quote
  #5 (permalink)  
Old 11-11-09, 11:15 AM
jonnekke jonnekke is offline
Code Guru
 
Join Date: Oct 2005
Location: holland!
Posts: 704
Thanks: 0
Thanked 0 Times in 0 Posts
Okay... but why is this not nescassary in the other part of the script?

And when I do that it's written there but the php is not included.

Last edited by jonnekke; 11-11-09 at 11:18 AM.
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiShare on FacebookShare on Stumble UponShare on Twitter
Reply With Quote
  #6 (permalink)  
Old 11-11-09, 11:21 AM
Nico's Avatar
Nico Nico is offline
Community Leader
 
Join Date: Sep 2005
Location: Spain
Posts: 8,074
Thanks: 11
Thanked 88 Times in 83 Posts
I thought you actually wanted to display it.

PHP is executed before Javascript, so you cannot do it this way.
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiShare on FacebookShare on Stumble UponShare on Twitter
Reply With Quote
  #7 (permalink)  
Old 11-12-09, 03:21 AM
jonnekke jonnekke is offline
Code Guru
 
Join Date: Oct 2005
Location: holland!
Posts: 704
Thanks: 0
Thanked 0 Times in 0 Posts
hmm... that's a shame...

I'm gonna create a hidden div that will be showed when there is no flash..

thnx!
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiShare on FacebookShare on Stumble UponShare on Twitter
Reply With Quote
  #8 (permalink)  
Old 11-18-09, 11:09 AM
jonnekke jonnekke is offline
Code Guru
 
Join Date: Oct 2005
Location: holland!
Posts: 704
Thanks: 0
Thanked 0 Times in 0 Posts
thnx..

do you also know how to write a &euro; as innerText?
Now it's displayed as &euro; instead of the euro-sign
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiShare on FacebookShare on Stumble UponShare on Twitter
Reply With Quote
  #9 (permalink)  
Old 11-19-09, 03:26 PM
wirehopper's Avatar
wirehopper wirehopper is offline
-
 
Join Date: Feb 2006
Posts: 2,516
Thanks: 20
Thanked 109 Times in 106 Posts
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiShare on FacebookShare on Stumble UponShare on Twitter
Reply With Quote
Reply

Bookmarks


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes

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 Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
C++ and MSSQL tutorials? scott2500uk C/C++ 8 05-11-09 03:33 AM
[SOLVED] 500 Internal Server Error - Please help Dawn Perl 15 07-08-08 12:08 PM
Syntax Error Nikas Database 4 05-15-08 11:48 AM
How to pass server response to Perticuler/Unique client javascript using php method PHP 1 03-25-07 07:02 AM
Editing a pre-defined Template Sfwr26 HTML/XHTML/XML 9 04-28-05 07:02 AM


All times are GMT -5. The time now is 01:15 PM.
vBulletin® Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.