Click to See Complete Forum and Search --> : document.write problems


spykemitchell
09-11-2003, 01:32 PM
I am having problems in getting the document.write function to display a block of HTML properly.

This is a document.write property i have got to work.

document.write("<center><br><u>HIM Uk Street Team</u><br><br><font size=2 face=verdana color=#ffffff>Featured Members:<br><br>")

This Functions Perfectly.

I want the following to work but it doesn't seem to.

document.write("<br><br><font size=2 face=verdana color=#df9d24><a href="who.htm" onmouseover="self.status=''; return true" onmouseout="self.status='' ; return true"><font size=2 face=verdana color=#df9d24>Who Are We?</a><br><br><a href="what.htm" onmouseover="self.status=''; return true" onmouseout="self.status='' ; return true"><font size=2 face=verdana color=#df9d24>What Do We Do?</a><br><br><a href="help.htm" onmouseover="self.status=''; return true" onmouseout="self.status='' ; return true"><font size=2 face=verdana color=#df9d24>How Can You Help?</a><br><br><a href="team.htm" onmouseover="self.status=''; return true" onmouseout="self.status='' ; return true"><font size=2 face=verdana color=#df9d24>Who Is On The Team?</a>")

I think it is because of the amount of " characters and ' characters. All i want to include is links with the onmouseover function in them in the document.write brackets but each time i get the error message ") expected." What can i do? I use style sheets so if you know how to do Onmouseover status bar effects with style sheets that would help.

Thanks,

Spyke.

requestcode
09-11-2003, 01:39 PM
You should use single quotes within double quotes or double quotes within single quotes. IF you you can't do that the you will need to excape the quotes like this \" or \' . That backwards slash in front of the quotes will tell javascript to treat them as normal text.

spykemitchell
09-11-2003, 01:55 PM
Yeah i understand that but in the onmouseover section of the links it uses both double quotation markas and single quotation marks and i tried putting \ in it but it didn't understand the command.

<a href="team.htm" onmouseover="self.status=''; return true" onmouseout="self.status='' ; return true">

onmouseout="self.status=' ' ; return true" See this bit doesn't work if i do that.

cmotor
09-11-2003, 03:45 PM
I just got through some problems with document.write Although I am not using a mouseover maybe the code below will give you some ideas.

This code works for me:
-cmotor

document.write('<link rel="stylesheet" href="styles/scream.css"><span class="error"><p>&nbsp;</p><p>&nbsp;<p/><p>&nbsp;</p>&nbsp;Error: </span><span class="copytext">The field below was not completed:<p style="text-indent:60px;"><span class="number">1 </span><span class="formfield">FIRST AND LAST NAME</span>&nbsp; &nbsp; &nbsp; <a href="javascript:history.go(-1);\">Click here to go back and fix it.</a>')

Shampie
09-11-2003, 03:53 PM
what happens if you don't put it between quotes? (meaning behind a property of the object ->
instead of (name="test") try (name=test)

If used it outside document.write but dont know how it will react within... g'luck