Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

concatenation of variables, functions, & strings 3

Status
Not open for further replies.

MikeDee

Programmer
Aug 2, 2001
19
0
0
GB
I'm really having troubles dynamically generating the below stuff?

I've tried using the \" \" that doesn't produce errors and also it doesn't seem to display the images??


document.write(&quot;<table width='501' border='0' cellspacing='0' cellpadding='0'>&quot;);
document.write(&quot;<tr>&quot;);
document.write(&quot;<td><img alt =\&quot;dfghgfhgf\&quot; border=0 height=10 src=\&quot;images_topmenu/spacer.GIF\&quot; width=491 onMouseOver=\&quot;MM_showHideLayers('Layer1','','hide','Layer2','','hide','Layer3','','hide','Layer4','','hide','Layer5','','hide')\&quot;></td>&quot;);
document.write(&quot;</tr>&quot;);
document.write(&quot;<tr>&quot;);

document.write(&quot;<td height=16><img&quot;);
document.write(&quot;height=17 width=10 src=\&quot;images_topmenu/spacer.GIF\&quot; border=0 onMouseOver=\&quot;MM_showHideLayers('Layer1','','hide','Layer2','','hide','Layer3','','hide','Layer4','','hide','Layer5','','hide')\&quot;><a href=\&quot;news.html\&quot; onMouseOver=\&quot;MM_showHideLayers('Layer1','','show');showMenu1(Layer1);hideMenu(Layer2);hideMenu(Layer3);hideMenu(Layer4);hideMenu(Layer5)\&quot;><img&quot;);


document.write(&quot;alt =\&quot;\&quot; border=0 height=17 name=Image311 src=\&quot;images_topmenu/menu1.gif\&quot;&quot;);
document.write(&quot;width=86></a><img&quot;);
document.write(&quot;height=17 width=10 src=\&quot;images_topmenu/spacer.GIF\&quot; border=0 onMouseOver=\&quot;MM_showHideLayers('Layer1','','hide','Layer2','','hide','Layer3','','hide','Layer4','','hide','Layer5','','hide')\&quot;><a href='cs_it.html' onMouseOver=MM_showHideLayers('Layer2','','show');showMenu2(Layer2);hideMenu(Layer1);hideMenu(Layer3);hideMenu(Layer4);hideMenu(Layer5)><img&quot;);
document.write(&quot;alt =\&quot;\&quot; border=0 height=17 name=Image411 src=\&quot;images_topmenu/menu2.gif\&quot;&quot;);
document.write(&quot;width=86></a><img&quot;);
document.write(&quot;height=17 width=10 src=\&quot;images_topmenu/spacer.GIF\&quot; border=0 onMouseOver=\&quot;MM_showHideLayers('Layer1','','hide','Layer2','','hide','Layer3','','hide','Layer4','','hide','Layer5','','hide')\&quot;><a href=\&quot;nboard.html\&quot; onMouseOver=\&quot;MM_showHideLayers('Layer3','','show');showMenu3(Layer3);hideMenu(Layer2);hideMenu(Layer1);hideMenu(Layer4);hideMenu(Layer5)\&quot;><img&quot;);
document.write(&quot;alt =\&quot;\&quot; border=0 height=17 name=Image511 src='images_topmenu/menu3.gif'&quot;);
document.write(&quot;width=86></a><img&quot;);
document.write(&quot;height=17 width=10 src=\&quot;images_topmenu/spacer.GIF\&quot; border=0 onMouseOver=\&quot;MM_showHideLayers('Layer1','','hide','Layer2','','hide','Layer3','','hide','Layer4','','hide','Layer5','','hide')\&quot;><a href=\&quot;eevents.html\&quot; onMouseOver=\&quot;MM_showHideLayers('Layer4','','show');showMenu4(Layer4);hideMenu(Layer2);hideMenu(Layer3);hideMenu(Layer1);hideMenu(Layer5)\&quot;><img&quot;);
document.write(&quot;alt =\&quot;\&quot; border=0 height=17 name=Image611 src='images_topmenu/menu4.gif'&quot;);
document.write(&quot;width=86></a><img&quot;);
document.write(&quot;height=17 width=10 src=\&quot;images_topmenu/spacer.GIF\&quot; border=0 onMouseOver=\&quot;MM_showHideLayers('Layer1','','hide','Layer2','','hide','Layer3','','hide','Layer4','','hide','Layer5','','hide')\&quot;><a href=\&quot; onMouseOver=\&quot;MM_showHideLayers('Layer5','','show');showMenu5(Layer5);hideMenu(Layer2);hideMenu(Layer3);hideMenu(Layer4);hideMenu(Layer1)\&quot;><img&quot;);
document.write(&quot;alt =\&quot;\&quot; border=0 height=17 name=Image711 src='images_topmenu/menu5.gif'&quot;);
document.write(&quot;width=86></a><img&quot;);
document.write(&quot;height=17 width=10 src=\&quot;images_topmenu/spacer.GIF\&quot; border=0 onMouseOver=\&quot;MM_showHideLayers('Layer1','','hide','Layer2','','hide','Layer3','','hide','Layer4','','hide','Layer5','','hide')\&quot;>&quot;);


document.write(&quot;</td></tr>&quot;);
document.write(&quot;</table>&quot;);
 
couldnt you use single quotes for your javascript strings allowing you to use double quotes for the html strings without \????
 
hie
be shure that u gave spaces between &quot;<img&quot; & smth else (i mean alt or height..)
u c, if u'll check for ur page src in netscrap (wich shows the result of javascript functions but not the functions themselfes) then u'll c that u have smth like <imgalt=.. or <imgheight=..
so write with space at the end: document.write(&quot;width=86></a><img &quot;); instead of &quot;<img&quot;
regards, vic
 
I've concatonated a long string with += and then did document.write (mystring). I've found it to be much cleaner, and easier to use variables inside the string. Here's an example I've used.

function showFileProperties(editablePath,viewablePath,strName,fileName,dateCreated,lastAccessed,lastModified,strType,filePath)
{

html = '<div align=&quot;center&quot;><img src=&quot;/intranet/library/icons/dir_belllogo.gif&quot; border=&quot;0&quot;><b>FILE PROPERTIES</b><br>'
html += '<br><a target=&quot;blank&quot; style=&quot;text-decoration: underline; color: #0066CC&quot; href=&quot;'
html += editablePath
html += '&quot;><b>EDIT' + strName + 'online? </b></a></div> <br>You can make changes to this file online by clicking EDIT above, modifying the file and then saving the file. Changes will appear the next time the file is opened.'
html += '<hr style=&quot;border-width:1px; border-color:#000066; border-style: thin&quot;'
html += '<br> Name:' + fileName
html += '<br> File Type:' + strType
html += '<br> Created:' + dateCreated
html += '<br> Last Accessed:' + lastAccessed
html += '<br> Last Modified:' + lastModified
html += '<br> Location:' + viewablePath
html += ''
document.write(html)
} Catch the vigorous horse of your mind!
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top